mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Split dots in filename, not the entire path
This commit is contained in:
parent
7606c13961
commit
b4936133bb
@ -84,7 +84,9 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
|
||||
}
|
||||
});
|
||||
|
||||
let Some((test_name, _)) = test.to_str().map(|s| s.split_once('.')).flatten() else {
|
||||
let Some((test_name, _)) =
|
||||
test.file_name().map(OsStr::to_str).flatten().map(|n| n.split_once('.')).flatten()
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
|
||||
@ -98,14 +100,20 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
|
||||
for sibling in files_under_inspection.iter().filter(|f| {
|
||||
f.extension().map(OsStr::to_str).flatten().is_some_and(|ext| EXTENSIONS.contains(&ext))
|
||||
}) {
|
||||
let filename_components = sibling.to_str().unwrap().split('.').collect::<Vec<_>>();
|
||||
let file_prefix = filename_components[0];
|
||||
|
||||
let Some((test_path, expected_revisions)) = test_info.get(file_prefix) else {
|
||||
let Some(filename) = sibling.file_name().map(OsStr::to_str).flatten() else {
|
||||
continue;
|
||||
};
|
||||
|
||||
match filename_components[..] {
|
||||
let filename_components = filename.split('.').collect::<Vec<_>>();
|
||||
let [file_prefix, ..] = &filename_components[..] else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let Some((test_path, expected_revisions)) = test_info.get(*file_prefix) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
match &filename_components[..] {
|
||||
// Cannot have a revision component, skip.
|
||||
[] | [_] => return,
|
||||
[_, _] if !expected_revisions.is_empty() => {
|
||||
@ -120,9 +128,9 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
|
||||
[_, _] => return,
|
||||
[_, found_revision, .., extension] => {
|
||||
if !IGNORES.contains(&found_revision)
|
||||
&& !expected_revisions.contains(found_revision)
|
||||
&& !expected_revisions.contains(*found_revision)
|
||||
// This is from `//@ stderr-per-bitwidth`
|
||||
&& !(extension == "stderr" && ["32bit", "64bit"].contains(&found_revision))
|
||||
&& !(*extension == "stderr" && ["32bit", "64bit"].contains(&found_revision))
|
||||
{
|
||||
// Found some unexpected revision-esque component that is not a known
|
||||
// compare-mode or expected revision.
|
||||
|
7
tests/ui/meta/dir.with.dots/test.rs
Normal file
7
tests/ui/meta/dir.with.dots/test.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/121986>.
|
||||
// Check that `tests_revision_unpaired_stdout_stderr` don't accidentally get confused by
|
||||
// paths containing periods.
|
||||
|
||||
//@ check-pass
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user