Function xpct::have_len

source ·
pub fn have_len<'a, Actual>(len: usize) -> Matcher<'a, Actual, Actual>where
    Actual: Debug + Len + 'a,
Expand description

Succeeds when the actual value has the given length.

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

Examples

use xpct::{expect, have_len};

expect!("foo").to(have_len(3));
expect!(&vec!["bar"]).to(have_len(1));