macro_rules! expect_empty {
( $a:expr ) => { ... };
}
Expand description
Expects that the given container (e.g., Vec
) is empty; otherwise returns early.
ยงExamples
fn passing_test() -> Result<()> {
let empty: Vec<i32> = vec![];
expect_empty!(empty);
Ok(())
}
fn failing_test() -> Result<()> {
expect_empty!(vec![0, 1, 1, 2, 3, 5, 8, 13, 21]); // returns early
Ok(()) // won't be reached
}