Skip to main content

every

Function every 

Source
pub fn every<C, M>(matcher: M) -> impl Matcher<C>
where C: Sequence + ?Sized, <C as Sequence>::Item: Debug, M: Matcher<<C as Sequence>::Item>,
Expand description

Matches a sequence in which every item satisfies matcher.

On failure the error names the index of the first item that did not match.

use test_better_core::TestResult;
use test_better_matchers::{every, check, gt};

fn main() -> TestResult {
    check!(vec![1, 2, 3]).satisfies(every(gt(0)))?;
    Ok(())
}