Module lib::assert_io_read_to_string
source · Expand description
Assert for comparing input/output reader streams.
These macros help with input/output readers, such as file handles, byte arrays,
input streams, the trait ::std::io::Read, and anything that implements a
method read_to_string() -> String.
Compare a reader with another reader:
assert_io_read_to_string_eq!(reader1, reader2)≈ reader1.read_to_string() = reader2.read_to_string()assert_io_read_to_string_ne!(reader1, reader2)≈ reader1.read_to_string() ≠ reader2.read_to_string()assert_io_read_to_string_lt!(reader1, reader2)≈ reader1.read_to_string() < reader2.read_to_string()assert_io_read_to_string_le!(reader1, reader2)≈ reader1.read_to_string() ≤ reader2.read_to_string()assert_io_read_to_string_gt!(reader1, reader2)≈ reader1.read_to_string() > reader2.read_to_string()assert_io_read_to_string_ge!(reader1, reader2)≈ reader1.read_to_string() ≥ reader2.read_to_string()
Compare a reader with an expression:
assert_io_read_to_string_eq_x!(reader, expr)≈ reader.read_to_string() = exprassert_io_read_to_string_ne_x!(reader, expr)≈ reader.read_to_string() ≠ exprassert_io_read_to_string_lt_x!(reader, expr)≈ reader.read_to_string() < exprassert_io_read_to_string_le_x!(reader, expr)≈ reader.read_to_string() ≤ exprassert_io_read_to_string_gt_x!(reader, expr)≈ reader.read_to_string() > exprassert_io_read_to_string_ge_x!(reader, expr)≈ reader.read_to_string() ≥ expr
Compare a reader with its contents:
assert_io_read_to_string_contains!(reader, &containee)≈ reader.read_to_string().contains(containee)assert_io_read_to_string_is_match!(reader, &matcher)≈ matcher.is_match(reader.read_to_string())
§Example
use assertables::*;
use std::io::Read;
let mut a = "alfa".as_bytes();
let mut b = "alfa".as_bytes();
assert_io_read_to_string_eq!(a, b);Modules§
- Assert a ::std::io::Read read_to_string() contains a pattern.
- Assert a ::std::io::Read read_to_string() value is equal to another.
- Assert a ::std::io::Read read_to_string() value is equal to an expression.
- Assert a ::std::io::Read read_to_string() value is greater than or equal to another.
- Assert a ::std::io::Read read_to_string() value is greater than or equal to an expression.
- Assert a ::std::io::Read read_to_string() value is greater than another.
- Assert a ::std::io::Read read_to_string() value is greater than an expression.
- Assert a ::std::io::Read read_to_string() is a match to a regex.
- Assert a ::std::io::Read read_to_string() value is less than or equal to another.
- Assert a ::std::io::Read read_to_string() value is less than or equal to an expression.
- Assert a ::std::io::Read read_to_string() value is less than another.
- Assert a ::std::io::Read read_to_string() value is less than an expression.
- Assert a ::std::io::read_to_string(path) is a match to a regex.
- Assert a ::std::io::Read read_to_string() is not equal to another.
- Assert a ::std::io::Read read_to_string() is not equal to an expression.