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).

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 = "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)`
// https://docs.rs/assertables/8.7.0/assertables/macro.assert_not_match.html
//  matcher label: `a`,
//  matcher debug: `Regex(\"lf\")`,
//  matchee label: `b`,
//  matchee debug: `\"alfa\"`

§Module macros