Ignore non .rs files for tidy libcoretest
Previously, any file would be read, which is both unnecessary, and causes issues if irrelevant non-Unicode files were read (e.g. `.DS_STORE`).
This commit is contained in:
parent
9d690d40d0
commit
ae41d6c32f
@ -22,12 +22,15 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
&libcore_path,
|
||||
&mut |subpath| t!(subpath.strip_prefix(&libcore_path)).starts_with("tests"),
|
||||
&mut |subpath| {
|
||||
if t!(read_to_string(subpath)).contains("#[test]") {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"{} contains #[test]; libcore tests must be placed inside `src/libcore/tests/`",
|
||||
subpath.display()
|
||||
);
|
||||
if subpath.ends_with(".rs") {
|
||||
if t!(read_to_string(subpath)).contains("#[test]") {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"{} contains #[test]; libcore tests must be placed inside \
|
||||
`src/libcore/tests/`",
|
||||
subpath.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user