Skip to content

Commit

Permalink
Turn the nonmodrs-mods test into a standard idempotence test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
flodiebold committed May 6, 2018
1 parent 215baae commit e65aa30
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 23 deletions.
17 changes: 0 additions & 17 deletions src/test/mod.rs
Expand Up @@ -232,23 +232,6 @@ fn self_tests() {
);
}

#[test]
fn issue_2673_non_modrs_mods() {
match idempotent_check(&PathBuf::from("tests/issue-2673-nonmodrs-mods/lib.rs")) {
Ok(ref report) if report.has_warnings() => {
print!("{}", report);
panic!("had warnings");
}
Ok(_report) => {}
Err(err) => {
if let IdempotentCheckError::Mismatch(msg) = err {
print_mismatches_default_message(msg);
}
panic!("had errors");
}
}
}

#[test]
fn stdin_formatting_smoke_test() {
let input = Input::Text("fn main () {}".to_owned());
Expand Down
1 change: 1 addition & 0 deletions tests/config/skip_children.toml
@@ -0,0 +1 @@
skip_children = true
3 changes: 0 additions & 3 deletions tests/issue-2673-nonmodrs-mods/foo.rs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/issue-2673-nonmodrs-mods/lib.rs

This file was deleted.

4 changes: 4 additions & 0 deletions tests/target/issue-2673-nonmodrs-mods/foo.rs
@@ -0,0 +1,4 @@
// rustfmt-config: skip_children.toml
mod bar;

mod baz {}
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/target/issue-2673-nonmodrs-mods/lib.rs
@@ -0,0 +1,6 @@
#![feature(non_modrs_mods)]

// Test that submodules in non-mod.rs files work. This is just an idempotence
// test since we just want to verify that rustfmt doesn't fail.

mod foo;

0 comments on commit e65aa30

Please sign in to comment.