Skip to content

Commit e65aa30

Browse files
committed
Turn the nonmodrs-mods test into a standard idempotence test
We need to skip children on foo.rs, since the parser will not find bar from that file, but with that, the test works fine.
1 parent 215baae commit e65aa30

File tree

7 files changed

+11
-23
lines changed

7 files changed

+11
-23
lines changed

src/test/mod.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -232,23 +232,6 @@ fn self_tests() {
232232
);
233233
}
234234

235-
#[test]
236-
fn issue_2673_non_modrs_mods() {
237-
match idempotent_check(&PathBuf::from("tests/issue-2673-nonmodrs-mods/lib.rs")) {
238-
Ok(ref report) if report.has_warnings() => {
239-
print!("{}", report);
240-
panic!("had warnings");
241-
}
242-
Ok(_report) => {}
243-
Err(err) => {
244-
if let IdempotentCheckError::Mismatch(msg) = err {
245-
print_mismatches_default_message(msg);
246-
}
247-
panic!("had errors");
248-
}
249-
}
250-
}
251-
252235
#[test]
253236
fn stdin_formatting_smoke_test() {
254237
let input = Input::Text("fn main () {}".to_owned());

tests/config/skip_children.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
skip_children = true

tests/issue-2673-nonmodrs-mods/foo.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/issue-2673-nonmodrs-mods/lib.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// rustfmt-config: skip_children.toml
2+
mod bar;
3+
4+
mod baz {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(non_modrs_mods)]
2+
3+
// Test that submodules in non-mod.rs files work. This is just an idempotence
4+
// test since we just want to verify that rustfmt doesn't fail.
5+
6+
mod foo;

0 commit comments

Comments
 (0)