macro_rules! assert_io_read_to_string_contains {
    ($reader:expr, $containee:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a std::io::Read read_to_string() contains a pattern.

  • 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 reader = "hello".as_bytes();
let containee = "ell";
assert_io_read_to_string_contains!(reader, &containee);

let mut reader = "hello".as_bytes();
let containee = "zzz";
assert_io_read_to_string_contains!(reader, &containee);
// assertion failed: `assert_io_read_to_string_contains!(reader, &containee)`
//     reader label: `&reader`,
//     reader debug: `[]`,
//  containee label: `&containee`,
//  containee debug: `\"zzz\"`,
//   read to string: `\"hello\"`,
//  containee value: `\"zzz\"`

§Module macros