Add a test for non-mod.rs mods

This commit is contained in:
Florian Diebold 2018-05-04 20:12:06 +02:00
parent cf573e8157
commit 215baae223
5 changed files with 24 additions and 1 deletions

View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@
fn dummy() {}

View File

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