#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

#29 in Rust patterns

Download history 159066/week @ 2024-09-18 171614/week @ 2024-09-25 178533/week @ 2024-10-02 190705/week @ 2024-10-09 193339/week @ 2024-10-16 212124/week @ 2024-10-23 198709/week @ 2024-10-30 209678/week @ 2024-11-06 195780/week @ 2024-11-13 184168/week @ 2024-11-20 104516/week @ 2024-11-27 162852/week @ 2024-12-04 205282/week @ 2024-12-11 118241/week @ 2024-12-18 54319/week @ 2024-12-25 143167/week @ 2025-01-01

562,821 downloads per month
Used in 262 crates (159 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–7MB
~49K SLoC