assertables

Macro assert_command_stderr_ne2

source
macro_rules! assert_command_stderr_ne2 {
    ($a_command:expr, $b_command:expr $(,)?) => { ... };
    ($a_command:expr, $b_command:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a command stderr string is equal to another.

Pseudocode:
(command1 ⇒ stderr) = (command2 ⇒ stderr)

  • 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-stderr");
a.args(["%s", "alfa"]);
let mut b = Command::new("bin/printf-stderr");
b.args(["%s", "zz"]);
assert_command_stderr_ne2!(a, b);

// This will panic
let mut a = Command::new("bin/printf-stderr");
a.args(["%s", "alfa"]);
let mut b = Command::new("bin/printf-stderr");
b.args(["%s", "alfa"]);
assert_command_stderr_ne2!(a, b);
// assertion failed: `assert_command_stderr_ne2!(a_command, b_command)`
// https://docs.rs/assertables/9.0.0/assertables/macro.assert_command_stderr_ne2.html
//  a label: `a`,
//  a debug: `\"bin/printf-stderr\" \"%s\" \"alfa\"`,
//  b label: `b`,
//  b debug: `\"bin/printf-stderr\" \"%s\" \"alfa\"`,
//        a: `[97, 108, 102, 97]`,
//        b: `[97, 108, 102, 97]`

§Module macros