diff options
author | Benjamin Sago <ogham@bsago.me> | 2017-09-28 19:00:01 +0100 |
---|---|---|
committer | Benjamin Sago <ogham@bsago.me> | 2017-09-30 09:17:29 +0200 |
commit | 541e6855f255ca4a9bb6f11f568474cdf13419a1 (patch) | |
tree | 5a9bb4db635cd643f4f3d9363f96e756db76647c | |
parent | 476299e21f92128d048f99d55958490251f20978 (diff) |
Test some actual ignore caches
-rw-r--r-- | src/fs/feature/ignore.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fs/feature/ignore.rs b/src/fs/feature/ignore.rs index f798137..1c129db 100644 --- a/src/fs/feature/ignore.rs +++ b/src/fs/feature/ignore.rs @@ -125,6 +125,9 @@ mod test { } + fn test_cache(dir: &'static str, pats: Vec<&str>) -> IgnoreCache { + IgnoreCache { entries: RwLock::new(vec![ (dir.into(), IgnorePatterns::parse_from_iter(pats.into_iter()).0) ]) } + } #[test] fn an_empty_cache_ignores_nothing() { @@ -132,4 +135,11 @@ mod test { assert_eq!(false, ignores.is_ignored(Path::new("/usr/bin/drinking"))); assert_eq!(false, ignores.is_ignored(Path::new("target/debug/exa"))); } + + #[test] + fn a_nonempty_cache_ignores_some_things() { + let ignores = test_cache("/vagrant", vec![ "target" ]); + assert_eq!(false, ignores.is_ignored(Path::new("/vagrant/src"))); + assert_eq!(true, ignores.is_ignored(Path::new("/vagrant/target"))); + } } |