Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/tools/tidy/src/libcoretest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ 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 let Some("rs") = subpath.extension().and_then(|e| e.to_str()) {
match read_to_string(subpath) {
Ok(contents) => {
if contents.contains("#[test]") {
tidy_error!(
bad,
"{} contains #[test]; libcore tests must be placed inside \
`src/libcore/tests/`",
subpath.display()
);
}
}
Err(err) => {
panic!("failed to read file {:?}: {}", subpath, err);
}
}
}
},
);
Expand Down