macro_rules! allow_duplicates {
    ($($x:tt)*) => { ... };
}
Expand description

Utility macro to permit a multi-snapshot run where all snapshots match.

Within this block, insta will allow an assertion to be run more than once (even inline) without generating another snapshot. Instead it will assert that snapshot expressions visited more than once are matching.

insta::allow_duplicates! {
    for x in (0..10).step_by(2) {
        let is_even = x % 2 == 0;
        insta::assert_debug_snapshot!(is_even, @"true");
    }
}

The first snapshot assertion will be used as a gold master and every further assertion will be checked against it. If they don’t match the assertion will fail.