summaryrefslogtreecommitdiffstats
path: root/src/tools/tidy/src/tests_placement.rs
blob: 9d0057df8bcd85f09ea4eeede8ee98db18c458a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()
        )
    }
}