macro_rules! assert_read_to_string_ge_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 greater 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

use std::io::Read;

let mut a = "alpha".as_bytes();
let mut b = "bravo".as_bytes();
assert_read_to_string_ge_other!(b, a);
//-> ()

let result = panic::catch_unwind(|| {
let mut a = "alpha".as_bytes();
let mut b = "bravo".as_bytes();
assert_read_to_string_ge_other!(a, b);
//-> panic!
});
let actual = result.unwrap_err().downcast::<String>().unwrap().to_string();
let expect = concat!(
    "assertion failed: `assert_read_to_string_ge_other!(left_reader, right_reader)`\n",
    "  left_reader label: `a`,\n",
    "  left_reader debug: `[]`,\n",
    " right_reader label: `b`,\n",
    " right_reader debug: `[]`,\n",
    "               left: `\"alpha\"`,\n",
    "              right: `\"bravo\"`"
);
assert_eq!(actual, expect);