Closed
Description
At testing, it's also necessary to have a macro to checking a specific error returned by a function.
This macro gets it, so it could be added to standard library:
// Checks that the function returns the given error.
macro_rules! test_err {
($func:expr, $err:expr) => ({
let func = $func;
match func {
Err(ref e) if *e == $err => (),
Err(e) => panic!("got error {:?}, want {:?}", e, $err),
_ => panic!("want error {:?}", $err),
}
})
}
Metadata
Metadata
Assignees
Labels
No labels