# HG changeset patch # User Georges Racinet # Date 2018-12-11 16:13:17 # Node ID 43ca24b772d693ed03015b7dc6060767794abc70 # Parent 576474baa209e69cd2fd94b2b6982ff04325dd2c rust: adapted hg-core tests for iteration over Result Now AncestorsIterator iters on Result diff --git a/rust/hg-core/src/ancestors.rs b/rust/hg-core/src/ancestors.rs --- a/rust/hg-core/src/ancestors.rs +++ b/rust/hg-core/src/ancestors.rs @@ -173,6 +173,7 @@ mod tests { ) -> Vec { AncestorsIterator::new(graph, initrevs, stoprev, inclusive) .unwrap() + .map(|res| res.unwrap()) .collect() } @@ -218,12 +219,12 @@ mod tests { fn test_contains() { let mut lazy = AncestorsIterator::new(Stub, vec![10, 1], 0, true).unwrap(); - assert!(lazy.contains(1)); - assert!(!lazy.contains(3)); + assert!(lazy.contains(1).unwrap()); + assert!(!lazy.contains(3).unwrap()); let mut lazy = AncestorsIterator::new(Stub, vec![0], 0, false).unwrap(); - assert!(!lazy.contains(NULL_REVISION)); + assert!(!lazy.contains(NULL_REVISION).unwrap()); } /// A corrupted Graph, supporting error handling tests @@ -255,7 +256,6 @@ mod tests { // inclusive=false looks up initrev's parents right away let mut iter = AncestorsIterator::new(Corrupted, vec![1], 0, false).unwrap(); - assert_eq!(iter.next(), Some(0)); - assert_eq!(iter.next(), None); + assert_eq!(iter.next(), Some(Err(GraphError::ParentOutOfRange(0)))); } }