#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 120109/week @ 2024-07-28 125072/week @ 2024-08-04 147228/week @ 2024-08-11 156322/week @ 2024-08-18 145894/week @ 2024-08-25 137484/week @ 2024-09-01 175702/week @ 2024-09-08 144444/week @ 2024-09-15 175993/week @ 2024-09-22 164096/week @ 2024-09-29 207088/week @ 2024-10-06 177846/week @ 2024-10-13 203218/week @ 2024-10-20 207766/week @ 2024-10-27 209485/week @ 2024-11-03 206178/week @ 2024-11-10

834,226 downloads per month
Used in 240 crates (149 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
~54K SLoC