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.
Pseudocode:
(command1 ⇒ stdout ⇒ string) = (command2 ⇒ stdout ⇒ string)
-
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 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)`
// https://docs.rs/assertables/8.14.0/assertables/macro.assert_command_stdout_eq.html
// 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\"`