-
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
Allow assert.Equal on string type alias without panicking on failure #661
Allow assert.Equal on string type alias without panicking on failure #661
Conversation
if !Equal(mockT, &struct{}{}, &struct{}{}) { | ||
t.Error("Equal should return true (pointer equality is based on equality of underlying value)") | ||
} | ||
var m map[string]interface{} | ||
if Equal(mockT, m["bar"], "something") { | ||
t.Error("Equal should return false") | ||
} | ||
if Equal(mockT, myType("1"), myType("2")) { | ||
t.Error("Equal should return false") | ||
} |
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.
This test will panic if the fix in assert/assertions.go
is reverted.
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.
Looks good, thank you for your patience!
@ernesto-jimenez @georgelesica-wf Merge this? 😊 |
@HaraldNordgren I'm waiting on merge permissions from @matryer - hang tight, sorry! |
The last tagged version of testify, 1.2.2, has a bug that causes a lot of issues for the class, fixed with stretchr/testify#661
Keep running into [googleforgames#661](stretchr/testify#661) - Allow assert.Equal on string type alias without panicking on failure So upgrading Testify to solve this.
Keep running into [googleforgames#661](stretchr/testify#661) - Allow assert.Equal on string type alias without panicking on failure So upgrading Testify to solve this.
Keep running into [#661](stretchr/testify#661) - Allow assert.Equal on string type alias without panicking on failure So upgrading Testify to solve this.
@ernesto-jimenez The old comparison against
reflect.String
is true for type aliases of string, but the type coercion panics. So let's compare the type instead of the kind, to avoid the panics.Fixes #644
Fixes #646