Macro assertables::assert_not_match
source · 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).
-
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 = "bravo";
assert_not_match!(a, b);
let a = Regex::new(r"lf").unwrap();
let b = "alfa";
assert_not_match!(a, b);
// assertion failed: `assert_not_match!(matcher, matchee)`
// matcher label: `a`,
// matcher debug: `Regex(\"lf\")`,
// matchee label: `b`,
// matchee debug: `\"alfa\"`