Macro assertables::assert_command_stdout_eq

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

Assert a command stdout string is equal to another.

  • 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 a = Command::new("bin/printf-stdout");
a.args(["%s", "hello"]);
let mut b = Command::new("bin/printf-stdout");
b.args(["%s%s%s%s%s", "h", "e", "l", "l", "o"]);
assert_command_stdout_eq!(a, b);

let mut a = Command::new("bin/printf-stdout");
a.args(["%s", "hello"]);
let mut b = Command::new("bin/printf-stdout");
b.args(["%s%s%s", "z", "z", "z"]);
assert_command_stdout_eq!(a, b);
// assertion failed: `assert_command_stdout_eq!(a_command, b_command)`
//  a label: `a`,
//  a debug: `\"bin/printf-stdout\" \"%s\" \"hello\"`,
//  b label: `b`,
//  b debug: `\"bin/printf-stdout\" \"%s%s%s\" \"z\" \"z\" \"z\"`,
//        a: `\"hello\"`,
//        b: `\"zzz\"`

§Module macros