Macro assertables::assert_command_stderr_eq
source · [−]macro_rules! assert_command_stderr_eq {
($left_command:expr, $right_command:expr $(,)?) => { ... };
($left_command:expr, $right_command:expr, $($arg:tt)+) => { ... };
}Expand description
Assert a command stderr string is equal to another.
-
When 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("printf");
let mut b = Command::new("printf");
assert_command_stderr_eq!(a, b);
//-> ()
let mut a = Command::new("printf");
let mut b = Command::new("printf");
b.args(["-v"]);
assert_command_stderr_eq!(a, b);
//-> panic!("…")
// assertion failed: `assert_command_stderr_eq!(left_command, right_command)`
// left command program: `\"printf\"`,
// right command program: `\"printf\"`,
// left stderr: `\"usage: printf format [arguments ...]\\n\"`,
// right stderr: `\"printf: illegal option -- v\\n\"`This macro has a second form where a custom message can be provided.