You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::assert_eq supports providing a custom panic message in a third argument (optionally followed by further parameters for the message arguments). pretty_assertions and similar-asserts both provide assert_eq! macros that are compatible.
snapbox however currently appears to hard-code it's panic message:
Yeah, I've recently gotten requests for this from others. When creating snapbox, I overlooked this because
I tend to use filesystem snapshots which provides enough extra context that I wasn't needing it
A lot of times, I'm needing to use Assert, meaning the macros don't get as much attention
The main care about I had was then handled with track_caller.
If we move forward with this, I would expect we'd try to match the new assert format that is coming out soon, where relevant.
My main concern is what the API should look like for something like this. Assert is a first class citizen in the API and should be able to be reused across calls (something which the current solution in #224 does not handle). I also don't like creating a bunch of variations of functions for different use cases. Maybe smaller builders off of Assert?
Activity
feat(snapbox)!: Support custom panic messages
feat(snapbox)!: Support custom panic messages
epage commentedon Aug 18, 2023
Yeah, I've recently gotten requests for this from others. When creating
snapbox, I overlooked this becauseAssert, meaning the macros don't get as much attentionThe main care about I had was then handled with
track_caller.If we move forward with this, I would expect we'd try to match the new assert format that is coming out soon, where relevant.
My main concern is what the API should look like for something like this.
Assertis a first class citizen in the API and should be able to be reused across calls (something which the current solution in #224 does not handle). I also don't like creating a bunch of variations of functions for different use cases. Maybe smaller builders off ofAssert?not-my-profile commentedon Aug 18, 2023
Do you have a link for or more context about that?
epage commentedon Aug 19, 2023
rust-lang/rust#111071
feat(assert): Add `assert_data_eq!`
feat(assert): Add `assert_data_eq!`
feat(assert): Add `assert_data_eq!`