summaryrefslogtreecommitdiffstats
path: root/src/tools/tidy/src/tests_placement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/tidy/src/tests_placement.rs')
-rw-r--r--src/tools/tidy/src/tests_placement.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/tidy/src/tests_placement.rs b/src/tools/tidy/src/tests_placement.rs
new file mode 100644
index 000000000..9d0057df8
--- /dev/null
+++ b/src/tools/tidy/src/tests_placement.rs
@@ -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()
+ )
+ }
+}