#diff #assert #debugging #color

dev similar-asserts

provides assert_eq! like macros with colorized diff output

9 stable releases

1.6.0 Sep 5, 2024
1.5.0 Aug 20, 2023
1.4.2 Aug 3, 2022
1.2.0 Jan 5, 2022
1.1.0 Feb 27, 2021

#27 in Rust patterns

Download history 146302/week @ 2024-08-24 135932/week @ 2024-08-31 173345/week @ 2024-09-07 145925/week @ 2024-09-14 175674/week @ 2024-09-21 165527/week @ 2024-09-28 204300/week @ 2024-10-05 177649/week @ 2024-10-12 203498/week @ 2024-10-19 208382/week @ 2024-10-26 208982/week @ 2024-11-02 205784/week @ 2024-11-09 181720/week @ 2024-11-16 131369/week @ 2024-11-23 125660/week @ 2024-11-30 181956/week @ 2024-12-07

654,277 downloads per month
Used in 251 crates (157 directly)

Apache-2.0

34KB
703 lines

similar-asserts

Build Status Crates.io License Documentation

similar-asserts is a crate that enhances the default assertion experience by using similar for diffing. It supports comparing either Debug or Serialize representations of values. On failed assertions it renders out a colorized diff to the terminal.

fn main() {
    let reference = vec![1, 2, 3, 4];
    similar_asserts::assert_eq!(reference, (0..4).collect::<Vec<_>>());
}

Dependencies

~0.3–7.5MB
~53K SLoC