Function xpct::be_sorted_by

source ·
pub fn be_sorted_by<'a, T, Actual>(
    predicate: impl Fn(&T, &T) -> Ordering + 'a
) -> Matcher<'a, Actual, Actual>where
    T: Ord + 'a,
    Actual: Debug + AsRef<[T]> + 'a,
Expand description

Succeeds when the actual value is sorted according to the given predicate.

Examples

use xpct::{be_sorted_by, expect};

expect!(vec!["a", "B", "c"]).to(be_sorted_by::<&str, _>(|a, b| {
    a.to_lowercase().cmp(&b.to_lowercase())
}));