macro_rules! assert_not_match {
($matcher:expr, $matchee:expr $(,)?) => { ... };
($matcher:expr, $matchee:expr, $($message:tt)+) => { ... };
}Expand description
Assert an expression (such as a regex) is not a match for an expression (such as a string).
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 assertables::*;
use regex::Regex;
let a = Regex::new(r"xx").expect("regex");
let b = "alfa";
assert_not_match!(a, b);
// This will panic
let a = Regex::new(r"lf").expect("regex");
let b = "alfa";
assert_not_match!(a, b);
// assertion failed: `assert_not_match!(matcher, matchee)`
// https://docs.rs/assertables/…/assertables/macro.assert_not_match.html
// matcher label: `a`,
// matcher debug: `Regex(\"lf\")`,
// matchee label: `b`,
// matchee debug: `\"alfa\"`