Show types in Eq if types don't match
This commit is contained in:
parent
4d3d17dd62
commit
66ad00ea84
@ -99,6 +99,12 @@ func (a Assert) NoError(actual error, msg ...interface{}) {
|
|||||||
// Eq asserts the given values match
|
// Eq asserts the given values match
|
||||||
func (a Assert) Eq(expected, actual interface{}, msg ...interface{}) {
|
func (a Assert) Eq(expected, actual interface{}, msg ...interface{}) {
|
||||||
t(a).Helper()
|
t(a).Helper()
|
||||||
|
if reflect.TypeOf(expected) != reflect.TypeOf(actual) {
|
||||||
|
msg = prepMsg(msg, `Expected %T(%#v), but got %T(%#v)`, expected, expected, actual, actual)
|
||||||
|
a(false, msg...)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
msg = prepMsg(msg, `Expected %#v, but got %#v`, expected, actual)
|
msg = prepMsg(msg, `Expected %#v, but got %#v`, expected, actual)
|
||||||
a(expected == actual, msg...)
|
a(expected == actual, msg...)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user