Skip to content
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

InEpsilonSlice doesn't append custom error message #1324

Closed
bushkov opened this issue Jan 13, 2023 · 4 comments · Fixed by #1548 · May be fixed by #1454
Closed

InEpsilonSlice doesn't append custom error message #1324

bushkov opened this issue Jan 13, 2023 · 4 comments · Fixed by #1548 · May be fixed by #1454
Labels
bug good first issue help wanted pkg-assert Change related to package testify/assert

Comments

@bushkov
Copy link

bushkov commented Jan 13, 2023

Bug summary

When InEpsilonSlice takes a custom error message and the assertion fails, the custom message isn't displayed.

The issue is that in InEpsilonSlice implementation, msgAndArgs isn't passed to InEpsilon when iterating over slice elements:

result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon)

It should be:

result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon, msgAndArgs...)

To reproduce

Write any test where InEpsilonSlice fails and takes a custom message. The message wouldn't be displayed.

@dolmen
Copy link
Collaborator

dolmen commented Aug 11, 2023

Here is a reproducer: https://go.dev/play/p/E-lLwVrMXym

@myusko
Copy link

myusko commented Feb 22, 2024

Is an issue still relevant? I see mentions in the #1483 PR that was merged.

cc @arjunmahishi

@brackendawson
Copy link
Collaborator

The custom error message is still not shown, this issue is valid.

@arjunmahishi
Copy link
Collaborator

I've addressed it in #1548 along with the http assertions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue help wanted pkg-assert Change related to package testify/assert
Projects
None yet
5 participants