Enforce type equality in test.AssertEquals (#4111)
Because it's annoying when you get `0 != 0`.
This commit is contained in:
parent
204ff0446f
commit
e165f86c65
|
@ -64,6 +64,9 @@ func AssertError(t *testing.T, err error, message string) {
|
|||
// AssertEquals uses the equality operator (==) to measure one and two
|
||||
func AssertEquals(t *testing.T, one interface{}, two interface{}) {
|
||||
t.Helper()
|
||||
if reflect.TypeOf(one) != reflect.TypeOf(two) {
|
||||
t.Fatalf("cannot test equality of different types: %T != %T", one, two)
|
||||
}
|
||||
if one != two {
|
||||
t.Fatalf("%#v != %#v", one, two)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue