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:
parent
215baae223
commit
e65aa302d3
@ -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());
|
||||
|
1
tests/config/skip_children.toml
Normal file
1
tests/config/skip_children.toml
Normal file
@ -0,0 +1 @@
|
||||
skip_children = true
|
@ -1,3 +0,0 @@
|
||||
mod bar;
|
||||
|
||||
mod baz {}
|
@ -1,3 +0,0 @@
|
||||
#![feature(non_modrs_mods)]
|
||||
|
||||
mod foo;
|
4
tests/target/issue-2673-nonmodrs-mods/foo.rs
Normal file
4
tests/target/issue-2673-nonmodrs-mods/foo.rs
Normal file
@ -0,0 +1,4 @@
|
||||
// rustfmt-config: skip_children.toml
|
||||
mod bar;
|
||||
|
||||
mod baz {}
|
6
tests/target/issue-2673-nonmodrs-mods/lib.rs
Normal file
6
tests/target/issue-2673-nonmodrs-mods/lib.rs
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user