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