macro_rules! assert_io_read_to_string_ne_x {
($a_reader:expr, $b_expr:expr $(,)?) => { ... };
($a_reader:expr, $b_expr:expr, $($message:tt)+) => { ... };
}Expand description
Assert a ::std::io::Read read_to_string() is not equal to an expression.
Pseudocode:
(reader.read_to_string(a_string) ⇒ a_string) ≠ (expr ⇒ b_string)
-
If true, return
a_string. -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
use std::io::Read;
let reader = "alfa".as_bytes();
let x = String::from("zz");
assert_io_read_to_string_ne_x!(reader, x);
// This will panic
let reader = "alfa".as_bytes();
let x = String::from("alfa");
assert_io_read_to_string_ne_x!(reader, x);
// assertion failed: `assert_io_read_to_string_ne_x!(a_reader, b_expr)`
// https://docs.rs/assertables/…/assertables/macro.assert_io_read_to_string_ne_x.html
// a_reader label: `reader`,
// a_reader debug: `[97, 108, 102, 97]`,
// b_expr label: `x`,
// b_expr debug: `\"alfa\"`,
// a: `\"alfa\"`,
// b: `\"alfa\"`