Macro assertables::assert_command_stderr_eq_expr

source ·
macro_rules! assert_command_stderr_eq_expr {
    ($a_command:expr, $b_expr:expr $(,)?) => { ... };
    ($a_command:expr, $b_expr:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a command stderr string is equal to an expression.

Pseudocode:
(command ⇒ stderr ⇒ string) = (expr into string)

  • If true, return ().

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

§Examples

use std::process::Command;

let mut command = Command::new("bin/printf-stderr");
command.args(["%s", "hello"]);
let s = String::from("hello");
assert_command_stderr_eq_expr!(command, s);

let mut command = Command::new("bin/printf-stderr");
command.args(["%s", "hello"]);
let s = String::from("zzz");
assert_command_stderr_eq_expr!(command, s);
// assertion failed: `assert_command_stderr_eq_expr!(command, expr)`
// https://docs.rs/assertables/8.7.0/assertables/macro.assert_command_stderr_eq_expr.html
//  command label: `command`,
//  command debug: `\"bin/printf-stderr\" \"%s\" \"hello\"`,
//     expr label: `s`,
//     expr debug: `\"zzz\"`,
//  command value: `\"hello\"`,
//     expr value: `\"zzz\"`

§Module macros