macro_rules! fail {
($fmt:expr, $($arg:expr),*) => { ... };
($fmt:expr) => { ... };
}Expand description
A macro to create a failing ExtelResult.
If this macro is called the underlying error will be of type
Error::TestFailed.
ยงExample
use extel::{fail, ExtelResult, errors::Error};
fn always_fail() -> ExtelResult {
let error_msg = "this is an error message!";
fail!("This test fails with this error {}", error_msg)
}
match always_fail() {
Ok(_) => panic!("test did not fail!"),
Err(e) => {
assert!(matches!(e, Error::TestFailed(_)));
assert_eq!(
"This test fails with this error this is an error message!",
e.to_string()
);
}
}