macro_rules! assert_program_args_stdout_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) stdout string is a match to a regex.

Pseudocode:
(program1 + args1 ⇒ command ⇒ stdout ⇒ string) is match (expr into string)

  • 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-stdout";
let args = ["%s", "hello"];
let matcher = Regex::new(r"el").unwrap();
assert_program_args_stdout_is_match!(&program, &args, &matcher);

let program = "bin/printf-stdout";
let args = ["%s", "hello"];
let matcher = Regex::new(r"zzz").unwrap();
assert_program_args_stdout_is_match!(&program, &args, &matcher);
// assertion failed: `assert_program_args_stdout_is_match!(a_program, b_matcher)`
// https://docs.rs/assertables/8.7.0/assertables/macro.assert_program_args_stdout_is_match.html
//  a_program label: `&program`,
//  a_program debug: `\"bin/printf-stdout\"`,
//     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