##// END OF EJS Templates
rust: adapted hg-core tests for iteration over Result...
Georges Racinet -
r40965:43ca24b7 default
parent child Browse files
Show More
@@ -173,6 +173,7 b' mod tests {'
173 ) -> Vec<Revision> {
173 ) -> Vec<Revision> {
174 AncestorsIterator::new(graph, initrevs, stoprev, inclusive)
174 AncestorsIterator::new(graph, initrevs, stoprev, inclusive)
175 .unwrap()
175 .unwrap()
176 .map(|res| res.unwrap())
176 .collect()
177 .collect()
177 }
178 }
178
179
@@ -218,12 +219,12 b' mod tests {'
218 fn test_contains() {
219 fn test_contains() {
219 let mut lazy =
220 let mut lazy =
220 AncestorsIterator::new(Stub, vec![10, 1], 0, true).unwrap();
221 AncestorsIterator::new(Stub, vec![10, 1], 0, true).unwrap();
221 assert!(lazy.contains(1));
222 assert!(lazy.contains(1).unwrap());
222 assert!(!lazy.contains(3));
223 assert!(!lazy.contains(3).unwrap());
223
224
224 let mut lazy =
225 let mut lazy =
225 AncestorsIterator::new(Stub, vec![0], 0, false).unwrap();
226 AncestorsIterator::new(Stub, vec![0], 0, false).unwrap();
226 assert!(!lazy.contains(NULL_REVISION));
227 assert!(!lazy.contains(NULL_REVISION).unwrap());
227 }
228 }
228
229
229 /// A corrupted Graph, supporting error handling tests
230 /// A corrupted Graph, supporting error handling tests
@@ -255,7 +256,6 b' mod tests {'
255 // inclusive=false looks up initrev's parents right away
256 // inclusive=false looks up initrev's parents right away
256 let mut iter =
257 let mut iter =
257 AncestorsIterator::new(Corrupted, vec![1], 0, false).unwrap();
258 AncestorsIterator::new(Corrupted, vec![1], 0, false).unwrap();
258 assert_eq!(iter.next(), Some(0));
259 assert_eq!(iter.next(), Some(Err(GraphError::ParentOutOfRange(0))));
259 assert_eq!(iter.next(), None);
260 }
260 }
261 }
261 }
General Comments 0
You need to be logged in to leave comments. Login now