Rollup merge of #106734 - albertlarsan68:deny-src-tests-in-tidy, r=Nilstrieb

Deny having src/test exisiting in tidy

Fixes #106724
This commit is contained in:
Matthias Krüger 2023-01-11 21:08:10 +01:00 committed by GitHub
commit 106df9ec98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -64,6 +64,7 @@ fn tidy_error(bad: &mut bool, args: impl Display) -> std::io::Result<()> {
pub mod primitive_docs;
pub mod style;
pub mod target_specific_tests;
pub mod tests_placement;
pub mod ui_tests;
pub mod unit_tests;
pub mod unstable_book;

View File

@ -76,6 +76,7 @@ macro_rules! check {
check!(extdeps, &root_path);
// Checks over tests.
check!(tests_placement, &root_path);
check!(debug_artifacts, &tests_path);
check!(ui_tests, &tests_path);
check!(mir_opt_tests, &tests_path, bless);

View File

@ -0,0 +1,15 @@
use std::path::Path;
const FORBIDDEN_PATH: &str = "src/test";
const ALLOWED_PATH: &str = "tests";
pub fn check(root_path: impl AsRef<Path>, bad: &mut bool) {
if root_path.as_ref().join(FORBIDDEN_PATH).exists() {
tidy_error!(
bad,
"Tests have been moved, please move them from {} to {}",
root_path.as_ref().join(FORBIDDEN_PATH).display(),
root_path.as_ref().join(ALLOWED_PATH).display()
)
}
}