@@ -2,29 +2,22 @@ use rustfix;
2
2
use std:: collections:: HashSet ;
3
3
use std:: fs;
4
4
5
- #[ test]
6
- fn multiple_fix_options_yield_no_suggestions ( ) {
7
- let json = fs:: read_to_string ( "./tests/edge-cases/skip-multi-option-lints.json" ) . unwrap ( ) ;
8
- let expected_suggestions =
9
- rustfix:: get_suggestions_from_json ( & json, & HashSet :: new ( ) , rustfix:: Filter :: Everything )
5
+ macro_rules! expect_empty_json_test {
6
+ ( $name: ident, $file: expr) => {
7
+ #[ test]
8
+ fn $name( ) {
9
+ let json = fs:: read_to_string( concat!( "./tests/edge-cases/" , $file) ) . unwrap( ) ;
10
+ let expected_suggestions = rustfix:: get_suggestions_from_json(
11
+ & json,
12
+ & HashSet :: new( ) ,
13
+ rustfix:: Filter :: Everything ,
14
+ )
10
15
. unwrap( ) ;
11
- assert ! ( expected_suggestions. is_empty( ) ) ;
16
+ assert!( expected_suggestions. is_empty( ) ) ;
17
+ }
18
+ } ;
12
19
}
13
20
14
- #[ test]
15
- fn out_of_bounds_test ( ) {
16
- let json = fs:: read_to_string ( "./tests/edge-cases/out_of_bounds.recorded.json" ) . unwrap ( ) ;
17
- let expected_suggestions =
18
- rustfix:: get_suggestions_from_json ( & json, & HashSet :: new ( ) , rustfix:: Filter :: Everything )
19
- . unwrap ( ) ;
20
- assert ! ( expected_suggestions. is_empty( ) ) ;
21
- }
22
-
23
- #[ test]
24
- fn utf8_identifiers_test ( ) {
25
- let json = fs:: read_to_string ( "./tests/edge-cases/utf8_idents.recorded.json" ) . unwrap ( ) ;
26
- let expected_suggestions =
27
- rustfix:: get_suggestions_from_json ( & json, & HashSet :: new ( ) , rustfix:: Filter :: Everything )
28
- . unwrap ( ) ;
29
- assert ! ( expected_suggestions. is_empty( ) ) ;
30
- }
21
+ expect_empty_json_test ! { multiple_fix_options_yield_no_suggestions, "skip-multi-option-lints.json" }
22
+ expect_empty_json_test ! { out_of_bounds_test, "out_of_bounds.recorded.json" }
23
+ expect_empty_json_test ! { utf8_identifiers_test, "utf8_idents.recorded.json" }
0 commit comments