-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
assert.InEpsilonSlice: include msgAndArgs on failed assertion #1454
base: master
Are you sure you want to change the base?
assert.InEpsilonSlice: include msgAndArgs on failed assertion #1454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need a regression test.
I expect that the test will also be a good base for further improvement (in separate PRs) in reporting errors such as the index of the mismatch.
Hi @dolmen, thank you for the quick review!
Can you provide more details about which regression tests you are referring to in the |
Related: #1231 (also about |
The test that you didn't write! We need to augment |
a2665e8
to
2be4cff
Compare
…reported in fail case
This blocked by #1483 that must be merged first. |
assert/assertions_test.go
Outdated
@@ -1915,6 +1915,17 @@ func TestInEpsilonSlice(t *testing.T) { | |||
0.04), "{2.2, 2.0} is not element-wise close to {2.1, 2.1} in epsilon=0.04") | |||
|
|||
False(t, InEpsilonSlice(mockT, "", nil, 1), "Expected non numeral slices to fail") | |||
|
|||
inEpsilonSliceMockT := new(mockTestingT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the variable to mockT
for consistency.
Summary
Added the
msgAndArgs
parameter to theInEpsilon
function for better error reporting in case of failed assertion.Related issues
Closes #1324