similar-asserts is a crate that enhances the default assertion
experience by using similar for diffing.
On failed assertions it renders out a colorized diff to the terminal.
It comes with a handful of macros to replace
Debugon assertion failure.
Serializeon assertion failure.
assert_str_eq!: compares both sides to strings and diffs those on failure.
use similar_asserts::assert_eq; assert_eq!((1..3).collect::<Vec<_>>(), vec![1, 2]);
Optionally the assertion macros also let you “name” the left and right side which will produce slightly more explicit output:
use similar_asserts::assert_eq; assert_eq!(expected: vec![1, 2], actual: (1..3).collect::<Vec<_>>());
unicodeenable improved character matching (enabled by default)
serdeturns on support for serde.