macro_rules! assert_program_args_stderr_is_match {
    ($a_program:expr, $a_args:expr, $matcher:expr $(,)?) => { ... };
    ($a_program:expr, $a_args:expr, $matcher:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a command (built with program and args) stderr string is a match to a regex.

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use regex::Regex;

let program = "bin/printf-stderr";
let args = ["%s", "hello"];
let matcher = Regex::new(r"ell").unwrap();
assert_program_args_stderr_is_match!(&program, &args, &matcher);

let program = "bin/printf-stderr";
let args = ["%s", "hello"];
let matcher = Regex::new(r"zzz").unwrap();
assert_program_args_stderr_is_match!(&program, &args, &matcher);
// assertion failed: `assert_program_args_stderr_is_match!(a_program, b_matcher)`
//  a_program label: `&program`,
//  a_program debug: `\"bin/printf-stderr\"`,
//     a_args label: `&args`,
//     a_args debug: `[\"%s\", \"hello\"]`,
//  b_matcher label: `&matcher`,
//  b_matcher debug: `Regex(\"zzz\")`,
//                a: `\"hello\"`,
//                b: `Regex(\"zzz\")`

§Module macros