Pull out recursive ui test check into its own function
This commit is contained in:
parent
a97d0aabc8
commit
fa31c7d49e
1 changed files with 37 additions and 28 deletions
|
|
@ -40,34 +40,7 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
|
|||
);
|
||||
}
|
||||
|
||||
let mut remaining_issue_names: BTreeSet<&str> = allowed_issue_names.clone();
|
||||
|
||||
let (ui, ui_fulldeps) = (path.join("ui"), path.join("ui-fulldeps"));
|
||||
let paths = [ui.as_path(), ui_fulldeps.as_path()];
|
||||
crate::walk::walk_no_read(&paths, |_, _| false, &mut |entry| {
|
||||
let file_path = entry.path();
|
||||
if let Some(ext) = file_path.extension().and_then(OsStr::to_str) {
|
||||
check_unexpected_extension(bad, file_path, ext);
|
||||
|
||||
// NB: We do not use file_stem() as some file names have multiple `.`s and we
|
||||
// must strip all of them.
|
||||
let testname =
|
||||
file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
|
||||
if ext == "stderr" || ext == "stdout" || ext == "fixed" {
|
||||
check_stray_output_snapshot(bad, file_path, testname);
|
||||
check_empty_output_snapshot(bad, file_path);
|
||||
}
|
||||
|
||||
deny_new_nondescriptive_test_names(
|
||||
bad,
|
||||
path,
|
||||
&mut remaining_issue_names,
|
||||
file_path,
|
||||
testname,
|
||||
ext,
|
||||
);
|
||||
}
|
||||
});
|
||||
let remaining_issue_names = recursively_check_ui_tests(bad, path, &allowed_issue_names);
|
||||
|
||||
// if there are any file names remaining, they were moved on the fs.
|
||||
// our data must remain up to date, so it must be removed from issues.txt
|
||||
|
|
@ -98,6 +71,42 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
|
|||
}
|
||||
}
|
||||
|
||||
fn recursively_check_ui_tests<'issues>(
|
||||
bad: &mut bool,
|
||||
path: &Path,
|
||||
allowed_issue_names: &'issues BTreeSet<&'issues str>,
|
||||
) -> BTreeSet<&'issues str> {
|
||||
let mut remaining_issue_names: BTreeSet<&str> = allowed_issue_names.clone();
|
||||
|
||||
let (ui, ui_fulldeps) = (path.join("ui"), path.join("ui-fulldeps"));
|
||||
let paths = [ui.as_path(), ui_fulldeps.as_path()];
|
||||
crate::walk::walk_no_read(&paths, |_, _| false, &mut |entry| {
|
||||
let file_path = entry.path();
|
||||
if let Some(ext) = file_path.extension().and_then(OsStr::to_str) {
|
||||
check_unexpected_extension(bad, file_path, ext);
|
||||
|
||||
// NB: We do not use file_stem() as some file names have multiple `.`s and we
|
||||
// must strip all of them.
|
||||
let testname =
|
||||
file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
|
||||
if ext == "stderr" || ext == "stdout" || ext == "fixed" {
|
||||
check_stray_output_snapshot(bad, file_path, testname);
|
||||
check_empty_output_snapshot(bad, file_path);
|
||||
}
|
||||
|
||||
deny_new_nondescriptive_test_names(
|
||||
bad,
|
||||
path,
|
||||
&mut remaining_issue_names,
|
||||
file_path,
|
||||
testname,
|
||||
ext,
|
||||
);
|
||||
}
|
||||
});
|
||||
remaining_issue_names
|
||||
}
|
||||
|
||||
fn check_unexpected_extension(bad: &mut bool, file_path: &Path, ext: &str) {
|
||||
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
|
||||
"rs", // test source files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue