galvanic_assert::matchers::collection

Function contains_in_order

Source
pub fn contains_in_order<'a, T, I, J>(
    expected_elements: I,
) -> Box<dyn Matcher<'a, J> + 'a>
where T: PartialEq + Debug + 'a, I: IntoIterator<Item = T> + 'a, J: IntoIterator<Item = T> + 'a, ContainsInOrder<T>: Matcher<'a, J>,
Expand description

Matches if the asserted collection contains all and only of the expected elements in the given order.

#Examples

use galvanic_assert::matchers::collection::*;
assert_that!(&vec![1,2,3,4,5,6], contains_in_order(vec![1,2,3,4,5,6]));
assert_that!(
    // 6 is missing
    assert_that!(&vec![1,2,3,4,5,6], contains_in_order(vec![1,2,3,4,5])),
    panics
);
assert_that!(
    // 7 is added
    assert_that!(&vec![1,2,3,4,5,6], contains_in_order(vec![1,2,3,4,5,6,7])),
    panics
);