assert_contains_in_order

Macro assert_contains_in_order 

Source
macro_rules! assert_contains_in_order {
    ($actual: expr, $expected: expr) => { ... };
}
Expand description

Asserts that both collections contain exactly the same elements found in the same order.

§Usage

    assert_contains_in_order!(actual, expected);

§Examples

Will succeed, both collections containt the same elements

    assert_contains_in_order!(vec!["a", "b", "c"], vec!["a", "b", "c"]);

Will succeed, actual collection has more elements, but all elements from the expectation are present in the same order.

    assert_contains_in_order!(vec!["a", "d", "b", "c"], vec!["a", "b", "c"]);

Will succeed, actual collection has a duplicate “a”, but all elements from the expectation are present in the same order.

    assert_contains_in_order!(vec!["a", "a", "b", "c"], vec!["a", "b", "c"]);

Will fail, actual collection is missing “c”

    assert_contains_in_order!(vec!["a", "b"], vec!["a", "b", "c"]);

Will fail, actual collection is in a different order

    assert_contains_in_order!(vec!["a", "c", "b"], vec!["a", "b", "c"]);