mock: mock.Anything still works backwards
Author: brackendawsonCreated Aug 24, 2026Updated Aug 24, 2026
Labelsbug
Description
This is very meta, and is probably a wontfix, but I feel like documenting it.
Step To Reproduce
func TestIfy(t *testing.T) {
m := mock.Mock{}
m.On("Do", "stuff").Return()
m.MethodCalled("Do", mock.Anything)
}Expected behavior
Test to fail. While "stuff" is anything, anything is not "stuff".
Actual behavior
Passes
Source: stretchr/testify