From 7db6cf2f3236d13aad9fcb808c88c86a7c8c7487 Mon Sep 17 00:00:00 2001 From: bootandy Date: Tue, 2 Jul 2019 00:54:58 +0100 Subject: [PATCH] Add test to handle single dot in path --- src/utils/mod.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 872192e..e6b1582 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -145,14 +145,14 @@ mod tests { fn test_simplify_dir() { let mut correct = HashSet::new(); correct.insert("a".to_string()); - assert!(simplify_dir_names(vec!["a"]) == correct); + assert_eq!(simplify_dir_names(vec!["a"]), correct); } #[test] fn test_simplify_dir_rm_subdir() { let mut correct = HashSet::new(); correct.insert("a/b".to_string()); - assert!(simplify_dir_names(vec!["a/b", "a/b/c", "a/b/d/f"]) == correct); + assert_eq!(simplify_dir_names(vec!["a/b", "a/b/c", "a/b/d/f"]), correct); } #[test] @@ -160,7 +160,7 @@ mod tests { let mut correct = HashSet::new(); correct.insert("a/b".to_string()); correct.insert("c".to_string()); - assert!(simplify_dir_names(vec!["a/b", "a/b//", "c", "c/"]) == correct); + assert_eq!(simplify_dir_names(vec!["a/b", "a/b//", "c", "c/"]), correct); } #[test] fn test_simplify_dir_rm_subdir_and_not_substrings() { @@ -168,6 +168,13 @@ mod tests { correct.insert("a/b".to_string()); correct.insert("c/a/b".to_string()); correct.insert("b".to_string()); - assert!(simplify_dir_names(vec!["a/b", "c/a/b/", "b"]) == correct); + assert_eq!(simplify_dir_names(vec!["a/b", "c/a/b/", "b"]), correct); + } + + #[test] + fn test_simplify_dir_dots() { + let mut correct = HashSet::new(); + correct.insert("src".to_string()); + assert_eq!(simplify_dir_names(vec!["src/."]), correct); } }