Macro similar_asserts::assert_str_eq[][src]

macro_rules! assert_str_eq {
    ($left_label : ident : $left : expr, $right_label : ident : $right : expr $(,)
 ?) => { ... };
    ($left_label : ident : $left : expr, $right_label : ident : $right : expr,
 $($arg : tt) *) => { ... };
    ($left : expr, $right : expr $(,) ?) => { ... };
    ($left : expr, $right : expr, $($arg : tt) *) => { ... };
}
Expand description

Asserts that two stringified expressions are equal to each other (using PartialEq).

This works similar to assert_eq! but before comparing the values they are stringified via ToString. This also uses a slightly different comparison display that is better optimized for normal strings.

On panic, this macro will print the values of the expressions with their debug representations with a colorized diff of the changes in the debug output.

Like assert!, this macro has a second form, where a custom panic message can be provided.

use similar_asserts::assert_str_eq;
assert_str_eq!("foobarbaz".replace("z", "zzz"), "foobarbazzz");