From 0153cc1bc791d0080a51246145b3208740bec686 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 15 Apr 2024 16:31:02 +0900 Subject: [PATCH] matchers: remove tests that directly modify RepoPathTree I'm going to extract generic map from RepoPathTree, and .get_visit_sets() will be inlined into FilesMatcher/PrefixMatcher. These removed tests should be covered by the corresponding matcher tests. --- lib/src/matchers.rs | 47 --------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/lib/src/matchers.rs b/lib/src/matchers.rs index b3a005d6b..3d501be1f 100644 --- a/lib/src/matchers.rs +++ b/lib/src/matchers.rs @@ -369,11 +369,6 @@ impl RepoPathTree { }) } - #[cfg(test)] - fn add_dir(&mut self, dir: &RepoPath) { - self.add(dir).is_dir = true; - } - fn add_file(&mut self, file: &RepoPath) { self.add(file).is_file = true; } @@ -446,48 +441,6 @@ mod tests { RepoPath::from_internal_string(value) } - #[test] - fn test_repo_path_tree_empty() { - let tree = RepoPathTree::new(); - assert_eq!(tree.get_visit_sets(RepoPath::root()), Visit::Nothing); - } - - #[test] - fn test_repo_path_tree_root() { - let mut tree = RepoPathTree::new(); - tree.add_dir(RepoPath::root()); - assert_eq!(tree.get_visit_sets(RepoPath::root()), Visit::Nothing); - } - - #[test] - fn test_repo_path_tree_dir() { - let mut tree = RepoPathTree::new(); - tree.add_dir(repo_path("dir")); - assert_eq!( - tree.get_visit_sets(RepoPath::root()), - Visit::sets(hashset! {RepoPathComponentBuf::from("dir")}, hashset! {}), - ); - tree.add_dir(repo_path("dir/sub")); - assert_eq!( - tree.get_visit_sets(repo_path("dir")), - Visit::sets(hashset! {RepoPathComponentBuf::from("sub")}, hashset! {}), - ); - } - - #[test] - fn test_repo_path_tree_file() { - let mut tree = RepoPathTree::new(); - tree.add_file(repo_path("dir/file")); - assert_eq!( - tree.get_visit_sets(RepoPath::root()), - Visit::sets(hashset! {RepoPathComponentBuf::from("dir")}, hashset! {}), - ); - assert_eq!( - tree.get_visit_sets(repo_path("dir")), - Visit::sets(hashset! {}, hashset! {RepoPathComponentBuf::from("file")}), - ); - } - #[test] fn test_nothingmatcher() { let m = NothingMatcher;