Add a test for non-mod.rs mods
This commit is contained in:
parent
cf573e8157
commit
215baae223
@ -75,7 +75,6 @@ fn module_file(
|
||||
relative: Option<ast::Ident>,
|
||||
codemap: &codemap::CodeMap,
|
||||
) -> Result<(PathBuf, Option<ast::Ident>), io::Error> {
|
||||
eprintln!("module_file {:?} {:?} {:?}", id, attrs, dir_path);
|
||||
if let Some(path) = parser::Parser::submod_path_from_attr(attrs, dir_path) {
|
||||
return Ok((path, None));
|
||||
}
|
||||
|
@ -232,6 +232,23 @@ 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());
|
||||
|
3
tests/issue-2673-nonmodrs-mods/foo.rs
Normal file
3
tests/issue-2673-nonmodrs-mods/foo.rs
Normal file
@ -0,0 +1,3 @@
|
||||
mod bar;
|
||||
|
||||
mod baz {}
|
1
tests/issue-2673-nonmodrs-mods/foo/bar.rs
Normal file
1
tests/issue-2673-nonmodrs-mods/foo/bar.rs
Normal file
@ -0,0 +1 @@
|
||||
fn dummy() {}
|
3
tests/issue-2673-nonmodrs-mods/lib.rs
Normal file
3
tests/issue-2673-nonmodrs-mods/lib.rs
Normal file
@ -0,0 +1,3 @@
|
||||
#![feature(non_modrs_mods)]
|
||||
|
||||
mod foo;
|
Loading…
x
Reference in New Issue
Block a user