tidy/tests_placement.rs
1use std::path::Path;
2
3use crate::diagnostics::DiagCtx;
4
5const FORBIDDEN_PATH: &str = "src/test";
6const ALLOWED_PATH: &str = "tests";
7
8pub fn check(root_path: &Path, diag_ctx: DiagCtx) {
9 let mut check = diag_ctx.start_check("tests_placement");
10
11 if root_path.join(FORBIDDEN_PATH).exists() {
12 check.error(format!(
13 "Tests have been moved, please move them from {} to {}",
14 root_path.join(FORBIDDEN_PATH).display(),
15 root_path.join(ALLOWED_PATH).display()
16 ));
17 }
18}