New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use stringified expressions instead of left
and right
#33
base: main
Are you sure you want to change the base?
Use stringified expressions instead of left
and right
#33
Conversation
Any interest in this? |
I'm thinking about the same thing, but maybe just let caller provide different names for |
@aquarhead It would actually be more complicated. You would need to add macro arguments to what are purportedly drop-in replacements for assert_eq. This breaks switching back with a one-liner. I like the stringified expressions; you can just configure it by introducing a |
@cormacrelf , can you give an example of what you mean by configuring with a |
let one = ...;
let very_fancy_two = ...;
assert_eq!(one, very_fancy_two); |
I don't understand. Does that show anything different from "left" and "right"? |
@rivy you’re confused because I said “can” instead of “could”. It doesn’t now, but it would if the two expressions passed to assert_eq were stringified and those strings were used instead of left and right. It would say |
@cormacrelf , thanks for the clarification. |
Hi and thanks for the helpful library!
I was annoyed a few times now by the panic message only showing
(left == right)
instead of my actual arguments to theassert_eq
call and had to add a custom message describing the arguments.This change also helps in remembering which side was the expected or the actual value (which happens to me...)
Slightly ugly things in this MR:
The following message is duplicated 4 times:
Some existing tests now also verify this new feature, I think it would be slightly prettier to make these tests also pass
x
andy
as arguments (so they don't check two things at once) and make a new test verify this new feature