Struct k9::MultilineString [−][src]
pub struct MultilineString(pub String);
Expand description
assert_equal! takes a std::fmt::Debug trait object as an argument
which doesn’t work well with multiline strings, since newline characters will be displayed as \n
For example this string:
let s = "A
B
C";
will be printed as a single line "A\nB\nC"
, which is not useful
for multiline comparison diff
Using this struct makes the original string serialize into a proper multiline string which will produce a nice line by line difference comparison when used together with assert_equal!.
ⓘ
use k9::{MultilineString, assert_equal};
let s1 = "A\nB\nC".to_string();
let s2 = "A\nD\nC";
assert_equal!(MultilineString(s1), MultilineString::new(s2));
Tuple Fields
0: String
Implementations
Trait Implementations
Make diff to display string as multi-line string
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.