@@ -287,8 +287,9 @@ mod single_test_should {
287
287
288
288
let result: ItemFn = single ( input_fn. clone ( ) , Default :: default ( ) ) . ast ( ) ;
289
289
290
- assert_eq ! ( result. attrs[ 0 ] , test_attribute) ;
291
- assert_eq ! ( & result. attrs[ 1 ..] , attributes. as_slice( ) ) ;
290
+ let ( generated_attribute, old_attributes) = result. attrs . split_last ( ) . unwrap ( ) ;
291
+ assert_eq ! ( old_attributes, attributes. as_slice( ) ) ;
292
+ assert_eq ! ( generated_attribute, & test_attribute) ;
292
293
}
293
294
294
295
#[ rstest]
@@ -648,7 +649,7 @@ mod cases_should {
648
649
assert ! ( tests. len( ) > 0 ) ;
649
650
650
651
for t in tests {
651
- assert_eq ! ( item_fn. attrs, & t. attrs[ 1 .. ] ) ;
652
+ assert_eq ! ( item_fn. attrs, & t. attrs[ ..t . attrs . len ( ) - 1 ] ) ;
652
653
}
653
654
}
654
655
@@ -669,7 +670,8 @@ mod cases_should {
669
670
670
671
let tokens = parametrize ( item_fn, info) ;
671
672
672
- let test_attrs = & TestsGroup :: from ( tokens) . get_all_tests ( ) [ 0 ] . attrs [ 1 ..] ;
673
+ let tests = TestsGroup :: from ( tokens) . get_all_tests ( ) ;
674
+ let test_attrs = tests[ 0 ] . attrs . split_last ( ) . unwrap ( ) . 1 ;
673
675
674
676
let l = given_attrs. len ( ) ;
675
677
@@ -886,9 +888,10 @@ mod cases_should {
886
888
let tokens = parametrize ( item_fn, info) ;
887
889
888
890
let tests = TestsGroup :: from ( tokens) . get_all_tests ( ) ;
891
+ let ( generated_attribute, old_attributes) = tests[ 0 ] . attrs . split_last ( ) . unwrap ( ) ;
889
892
890
- assert_eq ! ( tests [ 0 ] . attrs [ 0 ] , test_attribute ) ;
891
- assert_eq ! ( & tests [ 0 ] . attrs [ 1 .. ] , attributes . as_slice ( ) ) ;
893
+ assert_eq ! ( old_attributes , attributes . as_slice ( ) ) ;
894
+ assert_eq ! ( generated_attribute , & test_attribute ) ;
892
895
}
893
896
894
897
#[ test]
@@ -1213,8 +1216,8 @@ mod matrix_cases_should {
1213
1216
assert ! ( tests. len( ) > 0 ) ;
1214
1217
1215
1218
for t in tests {
1216
- let end = t. attrs . len ( ) - 1 ;
1217
- assert_eq ! ( item_fn. attrs, & t. attrs[ 1 ..end] ) ;
1219
+ let end = t. attrs . len ( ) - 2 ;
1220
+ assert_eq ! ( item_fn. attrs, & t. attrs[ 0 ..end] ) ;
1218
1221
}
1219
1222
}
1220
1223
@@ -1370,8 +1373,8 @@ mod matrix_cases_should {
1370
1373
assert ! ( tests. len( ) > 0 ) ;
1371
1374
1372
1375
for test in tests {
1373
- assert_eq ! ( test. attrs[ 0 ] , test_attribute ) ;
1374
- assert_eq ! ( & test. attrs[ 1 .. test. attrs. len( ) - 1 ] , attributes . as_slice ( ) ) ;
1376
+ assert_eq ! ( & test. attrs[ ..test . attrs . len ( ) - 2 ] , attributes . as_slice ( ) ) ;
1377
+ assert_eq ! ( test. attrs[ test. attrs. len( ) - 1 ] , test_attribute ) ;
1375
1378
}
1376
1379
}
1377
1380
@@ -1434,8 +1437,8 @@ mod matrix_cases_should {
1434
1437
assert ! ( tests. len( ) > 0 ) ;
1435
1438
1436
1439
for test in tests {
1437
- assert_eq ! ( test. attrs. last ( ) . unwrap ( ) , non_snake_case) ;
1438
- assert_eq ! ( & test. attrs[ 1 ..test. attrs. len( ) - 1 ] , attributes. as_slice( ) ) ;
1440
+ assert_eq ! ( & test. attrs[ test . attrs . len ( ) - 2 ] , non_snake_case) ;
1441
+ assert_eq ! ( & test. attrs[ ..test. attrs. len( ) - 2 ] , attributes. as_slice( ) ) ;
1439
1442
}
1440
1443
}
1441
1444
@@ -1926,11 +1929,11 @@ mod complete_should {
1926
1929
let attrs = attrs ( "#[first]#[second(arg)]" ) ;
1927
1930
1928
1931
for f in modules[ 0 ] . get_all_tests ( ) {
1929
- let end = f. attrs . len ( ) - 1 ;
1930
- assert_eq ! ( attrs, & f. attrs[ 1 ..end] ) ;
1932
+ let end = f. attrs . len ( ) - 2 ;
1933
+ assert_eq ! ( attrs, & f. attrs[ ..end] ) ;
1931
1934
}
1932
1935
for f in modules[ 1 ] . get_all_tests ( ) {
1933
- assert_eq ! ( attrs, & f. attrs[ 1 .. 3 ] ) ;
1936
+ assert_eq ! ( attrs, & f. attrs[ .. 2 ] ) ;
1934
1937
}
1935
1938
}
1936
1939
#[ test]
@@ -1939,7 +1942,7 @@ mod complete_should {
1939
1942
let attrs = attrs ( "#[third]#[forth(other)]" ) ;
1940
1943
1941
1944
for f in modules[ 1 ] . get_all_tests ( ) {
1942
- assert_eq ! ( attrs, & f. attrs[ 3 .. 5 ] ) ;
1945
+ assert_eq ! ( attrs, & f. attrs[ 2 .. 4 ] ) ;
1943
1946
}
1944
1947
}
1945
1948
}
0 commit comments