testify
testify copied to clipboard
Deprecate ObjectsAreEqual and ObjectsAreEqualValues from the assert package and move them in a separate package for reuse
The two methods are currently located in the assert
package making them easily mistaken as "assert" methods when in fact they only return a boolean which indicates if the objects are equal or equal values.
There is lots and lots of code that incorrectly assumes that these methods are asserting equality.
Although it is clear from their signature (they don't accept a testing.T
object), one assumes that everything in the assert package is asserting something about the arguments.
Can we move these in a separate package called something like equal
and deprecate the instances in assert
so at least people don't make the mistake again.
Just had a long discussion about this at work, and realised that this has caught quite a few of us out multiple times, so I'm in complete agreement that this should be moved to a seperate package that makes their intended use clear.
Created a PR for this https://github.com/stretchr/testify/pull/1279
I was bit by this today, I'm new to Go and getting my feet wet with testing and kept scratching my head why this method wasn't failing even when I passed in an obviously incorrect comparison object.
Looks like the PR is stuck in review limbo, hopefully this gets resolved soon.