diff options
Diffstat (limited to 'src/tools/cargo/crates/rustfix/tests/edge_cases.rs')
-rw-r--r-- | src/tools/cargo/crates/rustfix/tests/edge_cases.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/cargo/crates/rustfix/tests/edge_cases.rs b/src/tools/cargo/crates/rustfix/tests/edge_cases.rs new file mode 100644 index 000000000..42d1e405a --- /dev/null +++ b/src/tools/cargo/crates/rustfix/tests/edge_cases.rs @@ -0,0 +1,25 @@ +use rustfix; +use std::collections::HashSet; +use std::fs; + +macro_rules! expect_empty_json_test { + ($name:ident, $file:expr) => { + #[test] + fn $name() { + let json = fs::read_to_string(concat!("./tests/edge-cases/", $file)).unwrap(); + let expected_suggestions = rustfix::get_suggestions_from_json( + &json, + &HashSet::new(), + rustfix::Filter::Everything, + ) + .unwrap(); + assert!(expected_suggestions.is_empty()); + } + }; +} + +expect_empty_json_test! {out_of_bounds_test, "out_of_bounds.recorded.json"} +expect_empty_json_test! {utf8_identifiers_test, "utf8_idents.recorded.json"} +expect_empty_json_test! {empty, "empty.json"} +expect_empty_json_test! {no_main, "no_main.json"} +expect_empty_json_test! {indented_whitespace, "indented_whitespace.json"} |