mirror of
https://github.com/stretchr/testify.git
synced 2025-07-10 20:49:09 +00:00
Use valueOf to fix issue with []byte
This commit is contained in:
parent
faedd6eb63
commit
794aba658c
@ -37,10 +37,11 @@ func ObjectsAreEqual(expected, actual interface{}) bool {
|
||||
}
|
||||
|
||||
actualType := reflect.TypeOf(actual)
|
||||
if reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(expected)) {
|
||||
if actualType.ConvertibleTo(reflect.TypeOf(expected)) {
|
||||
expectedValue := reflect.ValueOf(expected)
|
||||
actualValue := reflect.ValueOf(actual)
|
||||
// Attempt comparison after type conversion
|
||||
if actual == expectedValue.Convert(actualType).Interface() {
|
||||
if actualValue == expectedValue.Convert(actualType).Interface() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user