-
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
EqualExportedValues can compare two slices #1584
Comments
The word See the doc:
How does this relate to slices and why is this function expected to behave the same as Looks like nonsense. |
That's one way to look at it. But I think it's also a pity that you have to use a slice wrapper when testing a function that returns a slice. Another option is to add a new function, but I'm not sure it's the best thing to do. Or we just accept using a slice wrapper is enough. |
Description
EqualExportedValues
does not handle slices for now, althoughEqual
andEqualValues
compare each element of 2 slices.Proposed solution
Removing the check that the provided variables are structs or pointers to structs here allows comparing two slices.
testify/assert/assertions.go
Line 629 in 352d243
Happy to propose a PR if you agree with this design!I made a PR to remove the described checks.
Use case
The implementation of EqualExportedValues can actually compare slices, if they are inside a struct.
Here is an example.
The text was updated successfully, but these errors were encountered: