Function xpct::contain_elements

source ·
pub fn contain_elements<'a, T, Expected, Actual>(
    elements: Expected
) -> Matcher<'a, Actual, Actual>where
    T: Debug + 'a,
    Actual: Debug + Contains<T> + 'a,
    Expected: Debug + IntoIterator + Clone + 'a,
    Expected::Item: Borrow<T>,
Expand description

Succeeds when the actual value contains all the given elements.

You can use this matcher for your own types by implementing Contains on them.

Examples

use xpct::{expect, contain_elements};

expect!("foobar").to(contain_elements(['f', 'b']));
expect!(["foo", "bar", "baz"]).to(contain_elements(["bar", "foo"]));