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 assertables::*;
use std::process::Command;
let mut command = Command::new("bin/printf-stdout");
command.args(["%s", "alfa"]);
let bytes = vec![b'a', b'l', b'f', b'a'];
assert_command_stdout_eq_expr!(command, &bytes);
let mut command = Command::new("bin/printf-stdout");
command.args(["%s", "alfa"]);
let bytes = vec![b'z'];
assert_command_stdout_eq_expr!(command, &bytes);
// assertion failed: `assert_command_stdout_eq_expr!(a_command, b_expr)`
// https://docs.rs/assertables/8.14.0/assertables/macro.assert_command_stdout_eq_expr.html
// a label: `command`,
// a debug: `\"bin/printf-stdout\" \"%s\" \"alfa\"`,
// b label: `&bytes`,
// b debug: `[122]`,
// a: `[97, 108, 102, 97]`,
// b: `[122]`