Skip to content

Use pretty-assertions and improve debug implementation of Key#19

Merged
lhemala merged 2 commits intolhemala:mainfrom
Luro02:feature/test-improvements
Jan 9, 2026
Merged

Use pretty-assertions and improve debug implementation of Key#19
lhemala merged 2 commits intolhemala:mainfrom
Luro02:feature/test-improvements

Conversation

@Luro02
Copy link
Contributor

@Luro02 Luro02 commented Dec 17, 2025

While writing tests and debugging #10, I had some trouble with the way keys and differences are displayed. To illustrate this, consider this code:

#[test]
fn test_showcase() {
    assert_eq!(
        vec![
            (
                Key::from_array(b"namespace_two"),
                Key::from_array(b"example_u16")
            ),
            (
                Key::from_array(b"namespace_one"),
                Key::from_array(b"example_i16")
            ),
        ],
        vec![
            (
                Key::from_array(b"namespace_one"),
                Key::from_array(b"example_u8")
            ),
            (
                Key::from_array(b"namespace_one"),
                Key::from_array(b"example_i8")
            ),
            (
                Key::from_array(b"namespace_one"),
                Key::from_array(b"example_u16")
            ),
            (
                Key::from_array(b"namespace_one"),
                Key::from_array(b"example_i16")
            ),
        ]
    );
}

Without pretty-assertions and the key debug impl it will be displayed as
image

Without pretty-assertions, but the binary string debug impl
image

with just pretty-assertions:
image

and this is how it looks like with both pretty-assertions and the binary string debug impl:

image

@lhemala
Copy link
Owner

lhemala commented Jan 9, 2026

Thanks for the addition!

@lhemala lhemala merged commit aeeb96b into lhemala:main Jan 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants