-
Notifications
You must be signed in to change notification settings - Fork 10
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
Compare strings instead of byte slices in tests #152
Comments
Alternatively, the string representation could be used in the assert message. |
Sounds good to me, let's do that. |
robinkrahl
added a commit
to robinkrahl/nitrocli
that referenced
this issue
Apr 16, 2021
Some of our tests compare byte slices which is very hard to debug if the assertion fails. This patch adds assertion messages containing the (lossy) string representation of the byte slice to make it easier to debug errors. Fixes d-e-s-o#152.
robinkrahl
added a commit
to robinkrahl/nitrocli
that referenced
this issue
Apr 16, 2021
Some of our tests compare byte slices which is very hard to debug if the assertion fails. This patch adds assertion messages containing the (lossy) string representation of the byte slice to make it easier to debug errors. Fixes d-e-s-o#152.
d-e-s-o
pushed a commit
that referenced
this issue
May 9, 2021
Some of our tests compare byte slices and are very hard to debug if the assertion fails due to they way these slices are printed. This patch adds assertion messages containing the (lossy) string representation of the byte slice to make it easier to debug errors. Fixes #152
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In some tests – for example
status::not_found_raw
–, we compare byte slices withassert_eq!
. This results in an error message that is very hard to read, see for example this log. Creating a string withString::from_utf8_lossy
and comparing it to a string value would be functionally identical but much easier to read.The text was updated successfully, but these errors were encountered: