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.
This commit is contained in:
Florian Diebold 2018-05-06 13:03:11 +02:00
parent 215baae223
commit e65aa302d3
7 changed files with 11 additions and 23 deletions

View File

@ -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());

View File

@ -0,0 +1 @@
skip_children = true

View File

@ -1,3 +0,0 @@
mod bar;
mod baz {}

View File

@ -1,3 +0,0 @@
#![feature(non_modrs_mods)]
mod foo;

View File

@ -0,0 +1,4 @@
// rustfmt-config: skip_children.toml
mod bar;
mod baz {}

View File

@ -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;