mirror of https://github.com/stretchr/testify.git
fix merge conflict
commit
d1472b75d1
|
@ -37,10 +37,10 @@ func ObjectsAreEqual(expected, actual interface{}) bool {
|
|||
}
|
||||
|
||||
actualType := reflect.TypeOf(actual)
|
||||
expectedType := reflect.TypeOf(expected)
|
||||
if actualType.ConvertibleTo(expectedType) {
|
||||
actualValue := reflect.ValueOf(actual).Convert(expectedType)
|
||||
if reflect.DeepEqual(actualValue.Interface(), expected) {
|
||||
if actualType.ConvertibleTo(reflect.TypeOf(expected)) {
|
||||
expectedValue := reflect.ValueOf(expected)
|
||||
// Attempt comparison after type conversion
|
||||
if reflect.DeepEqual(actual, expectedValue.Convert(actualType).Interface()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ func TestObjectsAreEqual(t *testing.T) {
|
|||
if !ObjectsAreEqual(nil, nil) {
|
||||
t.Error("objectsAreEqual should return true")
|
||||
}
|
||||
if ObjectsAreEqual(map[int]int{5: 10}, map[int]int{10: 20}) {
|
||||
t.Error("objectsAreEqual should return false")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -223,10 +226,10 @@ func TestContains(t *testing.T) {
|
|||
mockT := new(testing.T)
|
||||
list := []string{"Foo", "Bar"}
|
||||
complexList := []*A{
|
||||
&A{"b", "c"},
|
||||
&A{"d", "e"},
|
||||
&A{"g", "h"},
|
||||
&A{"j", "k"},
|
||||
{"b", "c"},
|
||||
{"d", "e"},
|
||||
{"g", "h"},
|
||||
{"j", "k"},
|
||||
}
|
||||
|
||||
if !Contains(mockT, "Hello World", "Hello") {
|
||||
|
|
Loading…
Reference in New Issue