Rename found_paths
to found_path_stems
This commit is contained in:
parent
c4c62a5591
commit
3f8d87beda
@ -554,7 +554,7 @@ struct TestCollectorCx {
|
||||
/// Mutable state used during test collection.
|
||||
struct TestCollector {
|
||||
tests: Vec<test::TestDescAndFn>,
|
||||
found_paths: HashSet<PathBuf>,
|
||||
found_path_stems: HashSet<PathBuf>,
|
||||
poisoned: bool,
|
||||
}
|
||||
|
||||
@ -573,21 +573,21 @@ pub fn collect_and_make_tests(config: Arc<Config>) -> Vec<test::TestDescAndFn> {
|
||||
|
||||
let cx = TestCollectorCx { config, cache, common_inputs_stamp, modified_tests };
|
||||
let mut collector =
|
||||
TestCollector { tests: vec![], found_paths: HashSet::new(), poisoned: false };
|
||||
TestCollector { tests: vec![], found_path_stems: HashSet::new(), poisoned: false };
|
||||
|
||||
collect_tests_from_dir(&cx, &mut collector, &cx.config.src_base, &PathBuf::new())
|
||||
.unwrap_or_else(|reason| {
|
||||
panic!("Could not read tests from {}: {reason}", cx.config.src_base.display())
|
||||
});
|
||||
|
||||
let TestCollector { tests, found_paths, poisoned } = collector;
|
||||
let TestCollector { tests, found_path_stems, poisoned } = collector;
|
||||
|
||||
if poisoned {
|
||||
eprintln!();
|
||||
panic!("there are errors in tests");
|
||||
}
|
||||
|
||||
check_overlapping_tests(&found_paths);
|
||||
check_for_overlapping_test_paths(&found_path_stems);
|
||||
|
||||
tests
|
||||
}
|
||||
@ -732,7 +732,7 @@ fn collect_tests_from_dir(
|
||||
|
||||
// Record the stem of the test file, to check for overlaps later.
|
||||
let rel_test_path = relative_dir_path.join(file_path.file_stem().unwrap());
|
||||
collector.found_paths.insert(rel_test_path);
|
||||
collector.found_path_stems.insert(rel_test_path);
|
||||
|
||||
let paths =
|
||||
TestPaths { file: file_path, relative_dir: relative_dir_path.to_path_buf() };
|
||||
@ -1023,11 +1023,11 @@ fn make_test_closure(
|
||||
/// To avoid problems, we forbid test names from overlapping in this way.
|
||||
///
|
||||
/// See <https://github.com/rust-lang/rust/pull/109509> for more context.
|
||||
fn check_overlapping_tests(found_paths: &HashSet<PathBuf>) {
|
||||
fn check_for_overlapping_test_paths(found_path_stems: &HashSet<PathBuf>) {
|
||||
let mut collisions = Vec::new();
|
||||
for path in found_paths {
|
||||
for path in found_path_stems {
|
||||
for ancestor in path.ancestors().skip(1) {
|
||||
if found_paths.contains(ancestor) {
|
||||
if found_path_stems.contains(ancestor) {
|
||||
collisions.push((path, ancestor));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user