macro_rules! assert_command_stderr_eq_str {
    ($command:expr, $str:expr $(,)?) => { ... };
    ($command:expr, $str:expr, $($arg:tt)+) => { ... };
}
Expand description

Assert a command stderr string is equal to a given string.

  • 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 str = "usage: printf format [arguments ...]\n";
assert_command_stderr_eq_str!(a, str);
//-> ()

let mut a = Command::new("printf");
let str = "xyz";
assert_command_stderr_eq_str!(a, str);
//-> panic!("…")
// assertion failed: `assert_command_stderr_eq_str!(command, str)`
//  command program: `\"printf\"`,
//  str: `\"xyz\"`
//  stderr: `\"usage: printf format [arguments ...]\n"`,

This macro has a second form where a custom message can be provided.