-
Notifications
You must be signed in to change notification settings - Fork 30
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
More expressive error messages #36
Comments
Great crate! I agree the messages could be improved a bit... I'm not sure that nice sentences can always be produced, though, without a large amount of effort... What if the example you mentioned produced the following instead?
|
Also, in addition to perhaps tweaking how the matchers display themselves, one thought I had was to add a third (possibly optional) "Explanation" or "Details" section, in addition to "Expected" and "Got"... This might be nice in cases where it's not totally obvious why "expected" and "got" didn't match? For example, say we had a matcher for numerical vectors. It would be nice if the output of this: let vector = vec![1., 1.000001, 0.99];
assert_that!(vector, is(almost_equal_to(1.).with_tol(1e-4))); was perhaps
Just thought I'd throw that out there... |
The Swift Hamcrest implementation prints error messages like this:
So the "explanation" is put in parentheses in the "Got" section. |
Enhance the error message format so that we can have a nicer error for the regular expression case. Right now it says:
Something like
Expected \d to match "abc"
would be much nicer.The text was updated successfully, but these errors were encountered: