Attribute Macro s_test_fixture::after [−][src]
#[after]Expand description
execute a function after the test is executed even if the test failled
Examples
#[test]
#[after(function_to_run(66))]
fn test() -> Result<(), ()> {
println!("before");
let i = -55;
if i == 0 {
Ok(())
} else if i == 2 {
return Ok(());
} else {
panic!("oh no!")
Ok(())
}
}
fn function_to_run(i:i32){
println!("I did {} thing(s)",i);
}will return
before
{panic statement}
I did 66 thing(s)