Macro assertables::assure_fn_ok_eq [−][src]
macro_rules! assure_fn_ok_eq { ($function:path, $left:expr, $right:expr $(,)?) => { ... }; ($function:path, $left:expr, $right:expr, $($arg:tt)+) => { ... }; }
Expand description
Assure one function ok() is equal to another function ok().
-
When true, return
Ok(true). -
When false, return
Ok(false). -
Otherwise, return
Errwith a message and the values of the expressions with their debug representations.
Examples
let x: Result<bool, &str> = assure_fn_ok_eq!(i32::from_str, "1", "1"); //-> Ok(true)
let x: Result<bool, &str> = assure_fn_ok_eq!(i32::from_str, "1", "2"); //-> Ok(false)
This macro has a second form where a custom message can be provided.