assert_contains_match

Macro assert_contains_match 

Source
macro_rules! assert_contains_match {
    ($left:expr, $right:expr $(,)?) => { ... };
    ($left:expr, $right:expr, $($arg:tt)+) => { ... };
}
Expand description

Asserts that left contains the right pattern (regular expression).

Commonly used when asserting pack output in integration tests. Expands to a regular expression match test and logs left (in unescaped and escaped form) as well as right on failure.

Multi-line mode is automatically enabled on regular expressions. If this is not what you want it can be disabled by adding (?-m) to the start of your pattern.

ยงExample

use libcnb_test::assert_contains_match;

let output = "Hello World!\nHello Integration Test!";
assert_contains_match!(output, "Test!$");