Skip to content

Ignore non .rs files for tidy libcoretest #50661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2018
Merged
Changes from 1 commit
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
15 changes: 9 additions & 6 deletions src/tools/tidy/src/libcoretest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you verified that adding #[test] inside libcore still triggers this warning? Path::ends_with I don't think will work with ".rs" here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, should have tested this properly. I've fixed it, and also improved the error message in the case of failure.

if t!(read_to_string(subpath)).contains("#[test]") {
tidy_error!(
bad,
"{} contains #[test]; libcore tests must be placed inside \
`src/libcore/tests/`",
subpath.display()
);
}
}
},
);
Expand Down