1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! 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`. See tutorial below.
//!
//! ## Macros
//!
//! Compare a reader with another reader:
//!
//! * [`assert_io_read_to_string_eq!(reader1, reader2)`](macro@crate::assert_io_read_to_string_eq) ≈ reader1.read_to_string() = reader2.read_to_string()
//! * [`assert_io_read_to_string_ne!(reader1, reader2)`](macro@crate::assert_io_read_to_string_ne) ≈ reader1.read_to_string() ≠ reader2.read_to_string()
//! * [`assert_io_read_to_string_lt!(reader1, reader2)`](macro@crate::assert_io_read_to_string_lt) ≈ reader1.read_to_string() < reader2.read_to_string()
//! * [`assert_io_read_to_string_le!(reader1, reader2)`](macro@crate::assert_io_read_to_string_le) ≈ reader1.read_to_string() ≤ reader2.read_to_string()
//! * [`assert_io_read_to_string_gt!(reader1, reader2)`](macro@crate::assert_io_read_to_string_gt) ≈ reader1.read_to_string() > reader2.read_to_string()
//! * [`assert_io_read_to_string_ge!(reader1, reader2)`](macro@crate::assert_io_read_to_string_ge) ≈ reader1.read_to_string() ≥ reader2.read_to_string()
//!
//! Compare a reader with an expression:
//!
//! * [`assert_io_read_to_string_eq_x!(reader, expr)`](macro@crate::assert_io_read_to_string_eq_x) ≈ reader.read_to_string() = expr
//! * [`assert_io_read_to_string_ne_x!(reader, expr)`](macro@crate::assert_io_read_to_string_ne_x) ≈ reader.read_to_string() ≠ expr
//! * [`assert_io_read_to_string_lt_x!(reader, expr)`](macro@crate::assert_io_read_to_string_lt_x) ≈ reader.read_to_string() < expr
//! * [`assert_io_read_to_string_le_x!(reader, expr)`](macro@crate::assert_io_read_to_string_le_x) ≈ reader.read_to_string() ≤ expr
//! * [`assert_io_read_to_string_gt_x!(reader, expr)`](macro@crate::assert_io_read_to_string_gt_x) ≈ reader.read_to_string() > expr
//! * [`assert_io_read_to_string_ge_x!(reader, expr)`](macro@crate::assert_io_read_to_string_ge_x) ≈ reader.read_to_string() ≥ expr
//!
//! Compare a reader with its contents:
//!
//! * [`assert_io_read_to_string_contains!(reader, &containee)`](macro@crate::assert_io_read_to_string_contains) ≈ reader.read_to_string().contains(containee)
//! * [`assert_io_read_to_string_is_match!(reader, matcher)`](macro@crate::assert_io_read_to_string_is_match) ≈ matcher.is_match(reader.read_to_string())
//!
//! # Example
//!
//! ```rust
//! 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);
//! ```
//!
//! ## Tutorial
//!
//! Rust has a concept of a "reader", such as using `::std::io::Read` to read bytes,
//! or to use the method `read_to_string` to read bytes into a string buffer.
//!
//! ```rust
//! use std::io::Read;
//! let mut reader = "hello".as_bytes();
//! let mut string = String::new();
//! let result = reader.read_to_string(&mut string);
//! ```
//!
//! Rust can compare a reader's string to another reader's string:
//!
//! ```rust
//! use std::io::Read;
//! let mut reader1 = "hello".as_bytes();
//! let mut reader2 = "world".as_bytes();
//! let mut a_string = String::new();
//! let mut b_string = String::new();
//! let result1 = reader1.read_to_string(&mut a_string);
//! let result2 = reader2.read_to_string(&mut b_string);
//! assert_ne!(a_string, b_string);
//! ```
//!
//! The `assertables` crate provides macros that do the reading and string buffering for you:
//!
//! ```rust
//! # use std::io::Read;
//! # use assertables::*;
//! let mut reader1 = "hello".as_bytes();
//! let mut reader2 = "world".as_bytes();
//! assert_io_read_to_string_ne!(reader1, reader2);
//! ```
// Compare another
// Compare expression
// Specializations
// Deprecated.