Macro assertables::assert_is_match
source · macro_rules! assert_is_match { ($matcher:expr, $matchee:expr $(,)?) => { ... }; ($matcher:expr, $matchee:expr, $($message:tt)+) => { ... }; }
Expand description
Assert a matcher is a match for an expression.
Pseudocode:
a.is_match(b)
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use std::process::Command;
use regex::Regex;
let a = Regex::new(r"lf").unwrap();
let b = "alfa";
assert_is_match!(a, b);
let a = Regex::new(r"lf").unwrap();
let b = "bravo";
assert_is_match!(a, b);
// assertion failed: `assert_is_match!(matcher, matchee)`
// https://docs.rs/assertables/8.7.0/assertables/macro.assert_is_match.html
// matcher label: `a`,
// matcher debug: `Regex(\"lf\")`,
// matchee label: `b`,
// matchee debug: `\"bravo\"`