#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

#24 in Rust patterns

Download history 123609/week @ 2024-07-19 121704/week @ 2024-07-26 125881/week @ 2024-08-02 140768/week @ 2024-08-09 161748/week @ 2024-08-16 143033/week @ 2024-08-23 133448/week @ 2024-08-30 169005/week @ 2024-09-06 146895/week @ 2024-09-13 182634/week @ 2024-09-20 162132/week @ 2024-09-27 201306/week @ 2024-10-04 177006/week @ 2024-10-11 197194/week @ 2024-10-18 223915/week @ 2024-10-25 147282/week @ 2024-11-01

785,477 downloads per month
Used in 235 crates (147 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
~50K SLoC