Macro assertables::assert_command_stdout_eq_expr

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

Assert a command stdout string is equal to an expression.

  • 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-stdout");
command.args(["%s", "hello"]);
let s = String::from("hello");
assert_command_stdout_eq_expr!(command, s);

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

§Module macros