macro_rules! assert_program_args_stderr_le { ($a_program:expr, $a_args:expr, $b_program:expr, $b_args:expr $(,)?) => { ... }; ($a_program:expr, $a_args:expr, $b_program:expr, $($message:tt)+) => { ... }; }
Expand description
Assert a command (built with program and args) stderr string is less than or equal to another.
-
If true, return
()
. -
Otherwise, call
panic!
with a message and the values of the expressions with their debug representations.
Examples
// Return Ok
let a_program = "bin/printf-stderr";
let a_args = ["%s", "hello"];
let b_program = "bin/printf-stderr";
let b_args = ["%s", "hullo"];
assert_program_args_stderr_le!(&a_program, &a_args, &b_program, &b_args);
//-> ()
let a_program = "bin/printf-stderr";
let a_args = ["%s", "hello"];
let b_program = "bin/printf-stderr";
let b_args = ["%s", "hallo"];
assert_program_args_stderr_le!(&a_program, &a_args, &b_program, &b_args);
//-> panic!("…")
let actual = result.unwrap_err().downcast::<String>().unwrap().to_string();
let expect = concat!(
"assertion failed: `assert_program_args_stderr_le!(left_program, left_args, right_program, right_args)`\n",
" left_program label: `&a_program`,\n",
" left_program debug: `\"bin/printf-stderr\"`,\n",
" left_args label: `&a_args`,\n",
" left_args debug: `[\"%s\", \"hello\"]`,\n",
" right_program label: `&b_program`,\n",
" right_program debug: `\"bin/printf-stderr\"`,\n",
" right_args label: `&b_args`,\n",
" right_args debug: `[\"%s\", \"hallo\"]`,\n",
" left: `\"hello\"`,\n",
" right: `\"hallo\"`"
);
assert_eq!(actual, expect);
/// # Related