use crate::files::is_ignored_dir;
use crate::languages::{source_extensions, vendored_dirs};
#[test]
fn hardcoded_directories_are_ignored() {
for name in [".git", "build", "dist", ".cache"] {
assert!(
is_ignored_dir(name),
"{name} should be in the hardcoded ignored list"
);
}
}
#[test]
fn every_language_declared_vendored_dir_is_ignored() {
for dir in vendored_dirs() {
assert!(
is_ignored_dir(dir),
"vendored dir `{dir}` from the language registry must be ignored"
);
}
}
#[test]
fn ignored_dir_match_is_case_insensitive() {
for name in ["VENV", "Node_Modules", "TARGET", "Build"] {
assert!(
is_ignored_dir(name),
"{name} should match regardless of case"
);
}
}
#[test]
fn egg_info_dirs_are_ignored_but_other_extensions_with_egg_are_not() {
assert!(is_ignored_dir("foo.egg-info"), "a `.egg-info` is metadata");
assert!(is_ignored_dir("Foo.Egg-Info"), "case-insensitive");
assert!(!is_ignored_dir("foo.egg"), "a `.egg` file is just a file");
assert!(!is_ignored_dir("src"), "source code, not vendored");
let _ = source_extensions();
}
#[test]
fn dirs_other_ecosystems_fill_with_real_source_are_not_ignored() {
for name in ["bin", "obj", "out", "src", "lib", "app", "scripts", "cmd"] {
assert!(
!is_ignored_dir(name),
"`{name}` holds real source somewhere and must stay walkable"
);
}
}