Macro assert_io_read_to_string_contains

Source
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.

Pseudocode:
(reader.read_to_string(a_string) ⇒ a_string) contains (expr)

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

// This will panic
let mut reader = "hello".as_bytes();
let containee = "zz";
assert_io_read_to_string_contains!(reader, &containee);
// assertion failed: `assert_io_read_to_string_contains!(reader, &containee)`
// https://docs.rs/assertables/9.5.3/assertables/macro.assert_io_read_to_string_contains.html
//     reader label: `&reader`,
//     reader debug: `[]`,
//  containee label: `&containee`,
//  containee debug: `\"zz\"`,
//           string: `\"hello\"`

§Module macros