macro_rules! assert_read_to_string_le_other {
($a_reader:expr, $b_reader:expr $(,)?) => { ... };
($a_reader:expr, $b_reader:expr, $($arg:tt)+) => { ... };
}Expand description
Assert a std::io::Read read_to_string() value is less than or equal to another.
-
When true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
Examples
use std::io::Read;
let mut a = "alpha".as_bytes();
let mut b = "bravo".as_bytes();
assert_read_to_string_le_other!(a, b);
//-> ()
let result = panic::catch_unwind(|| {
let mut a = "bravo".as_bytes();
let mut b = "alpha".as_bytes();
assert_read_to_string_le_other!(a, b);
//-> panic!
});
let actual = result.unwrap_err().downcast::<String>().unwrap().to_string();
let expect = concat!(
"assertion failed: `assert_read_to_string_le_other!(left_reader, right_reader)`\n",
" left reader name: `a`,\n",
" right reader name: `b`,\n",
" left reader size: `5`,\n",
" right reader size: `5`,\n",
" left reader data: `\"bravo\"`,\n",
" right reader data: `\"alpha\"`"
);
assert_eq!(actual, expect);