Show More
@@ -196,7 +196,7 b' mod tests {' | |||||
196 | let manifest: Vec<HgPathBuf> = vec![]; |
|
196 | let manifest: Vec<HgPathBuf> = vec![]; | |
197 | let mut map = DirsMultiset::from_manifest(&manifest).unwrap(); |
|
197 | let mut map = DirsMultiset::from_manifest(&manifest).unwrap(); | |
198 | let path = HgPath::new(b""); |
|
198 | let path = HgPath::new(b""); | |
199 | map.add_path(path); |
|
199 | map.add_path(path).unwrap(); | |
200 |
|
200 | |||
201 | assert_eq!(1, map.len()); |
|
201 | assert_eq!(1, map.len()); | |
202 | } |
|
202 | } | |
@@ -206,36 +206,36 b' mod tests {' | |||||
206 | let manifest: Vec<HgPathBuf> = vec![]; |
|
206 | let manifest: Vec<HgPathBuf> = vec![]; | |
207 | let mut map = DirsMultiset::from_manifest(&manifest).unwrap(); |
|
207 | let mut map = DirsMultiset::from_manifest(&manifest).unwrap(); | |
208 |
|
208 | |||
209 | map.add_path(HgPath::new(b"a/")); |
|
209 | map.add_path(HgPath::new(b"a/")).unwrap(); | |
210 | assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap()); |
|
210 | assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap()); | |
211 | assert_eq!(1, *map.inner.get(HgPath::new(b"")).unwrap()); |
|
211 | assert_eq!(1, *map.inner.get(HgPath::new(b"")).unwrap()); | |
212 | assert_eq!(2, map.len()); |
|
212 | assert_eq!(2, map.len()); | |
213 |
|
213 | |||
214 | // Non directory should be ignored |
|
214 | // Non directory should be ignored | |
215 | map.add_path(HgPath::new(b"a")); |
|
215 | map.add_path(HgPath::new(b"a")).unwrap(); | |
216 | assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap()); |
|
216 | assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap()); | |
217 | assert_eq!(2, map.len()); |
|
217 | assert_eq!(2, map.len()); | |
218 |
|
218 | |||
219 | // Non directory will still add its base |
|
219 | // Non directory will still add its base | |
220 | map.add_path(HgPath::new(b"a/b")); |
|
220 | map.add_path(HgPath::new(b"a/b")).unwrap(); | |
221 | assert_eq!(2, *map.inner.get(HgPath::new(b"a")).unwrap()); |
|
221 | assert_eq!(2, *map.inner.get(HgPath::new(b"a")).unwrap()); | |
222 | assert_eq!(2, map.len()); |
|
222 | assert_eq!(2, map.len()); | |
223 |
|
223 | |||
224 | // Duplicate path works |
|
224 | // Duplicate path works | |
225 | map.add_path(HgPath::new(b"a/")); |
|
225 | map.add_path(HgPath::new(b"a/")).unwrap(); | |
226 | assert_eq!(3, *map.inner.get(HgPath::new(b"a")).unwrap()); |
|
226 | assert_eq!(3, *map.inner.get(HgPath::new(b"a")).unwrap()); | |
227 |
|
227 | |||
228 | // Nested dir adds to its base |
|
228 | // Nested dir adds to its base | |
229 | map.add_path(HgPath::new(b"a/b/")); |
|
229 | map.add_path(HgPath::new(b"a/b/")).unwrap(); | |
230 | assert_eq!(4, *map.inner.get(HgPath::new(b"a")).unwrap()); |
|
230 | assert_eq!(4, *map.inner.get(HgPath::new(b"a")).unwrap()); | |
231 | assert_eq!(1, *map.inner.get(HgPath::new(b"a/b")).unwrap()); |
|
231 | assert_eq!(1, *map.inner.get(HgPath::new(b"a/b")).unwrap()); | |
232 |
|
232 | |||
233 | // but not its base's base, because it already existed |
|
233 | // but not its base's base, because it already existed | |
234 | map.add_path(HgPath::new(b"a/b/c/")); |
|
234 | map.add_path(HgPath::new(b"a/b/c/")).unwrap(); | |
235 | assert_eq!(4, *map.inner.get(HgPath::new(b"a")).unwrap()); |
|
235 | assert_eq!(4, *map.inner.get(HgPath::new(b"a")).unwrap()); | |
236 | assert_eq!(2, *map.inner.get(HgPath::new(b"a/b")).unwrap()); |
|
236 | assert_eq!(2, *map.inner.get(HgPath::new(b"a/b")).unwrap()); | |
237 |
|
237 | |||
238 | map.add_path(HgPath::new(b"a/c/")); |
|
238 | map.add_path(HgPath::new(b"a/c/")).unwrap(); | |
239 | assert_eq!(1, *map.inner.get(HgPath::new(b"a/c")).unwrap()); |
|
239 | assert_eq!(1, *map.inner.get(HgPath::new(b"a/c")).unwrap()); | |
240 |
|
240 | |||
241 | let expected = DirsMultiset { |
|
241 | let expected = DirsMultiset { |
General Comments 0
You need to be logged in to leave comments.
Login now