assert_text_match

Macro assert_text_match 

Source
macro_rules! assert_text_match {
    ($left: expr, $right: expr) => { ... };
}
Expand description

Asserts that the first text expression matches the given regular expression.

If the text does not match the regex, it panics.

§Arguments

  • $left - The text expression to check.
  • $right - The regular expression string.

§Panics

Panics if the $right string is not a valid regular expression.

§Examples

use assert_text::assert_text_match;
assert_text_match!("hello world", r"^h.+d$");
use assert_text::assert_text_match;
assert_text_match!("hello world", r"^goodbye.*");