Mercurial > hg
changeset 40929:43ca24b772d6
rust: adapted hg-core tests for iteration over Result
Now AncestorsIterator iters on Result<Revision, GraphError>
author | Georges Racinet <gracinet@anybox.fr> |
---|---|
date | Tue, 11 Dec 2018 17:13:17 +0100 |
parents | 576474baa209 |
children | fcdff048a8e5 |
files | rust/hg-core/src/ancestors.rs |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/ancestors.rs Tue Dec 11 21:57:54 2018 -0500 +++ b/rust/hg-core/src/ancestors.rs Tue Dec 11 17:13:17 2018 +0100 @@ -173,6 +173,7 @@ ) -> Vec<Revision> { AncestorsIterator::new(graph, initrevs, stoprev, inclusive) .unwrap() + .map(|res| res.unwrap()) .collect() } @@ -218,12 +219,12 @@ 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 @@ // 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)))); } }