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

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.