macro_rules! assert_command_stdout_contains {
    ($command:expr, $b:expr $(,)?) => { ... };
    ($command:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a command stdout string contains a given containee.

  • If true, return ().

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

This uses std::String method contains.

  • The containee can be a &str, char, a slice of chars, or a function or closure that determines if a character contains.

§Examples

use std::process::Command;

let mut command = Command::new("bin/printf-stdout");
command.args(["%s", "hello"]);
let containee = "ell";
assert_command_stdout_contains!(command, &containee);

let mut command = Command::new("bin/printf-stdout");
command.args(["%s", "hello"]);
let containee = "zzz";
assert_command_stdout_contains!(command, &containee);
// assertion failed: `assert_command_stdout_contains!(command, containee)`
//    command label: `command`,
//    command debug: `\"bin/printf-stdout\" \"%s\" \"hello\"`,
//  containee label: `&containee`,
//  containee debug: `\"zzz\"`,
//    command value: `\"hello\"`

§Module macros