Forwards EqualValues assertion

pull/137/head
Justin Cummins 2015-02-18 14:08:46 -08:00
parent efa3c4c364
commit d5621338a3
2 changed files with 18 additions and 0 deletions

View File

@ -38,6 +38,16 @@ func (a *Assertions) Equal(expected, actual interface{}, msgAndArgs ...interface
return Equal(a.t, expected, actual, msgAndArgs...)
}
// EqualValues asserts that two objects are equal or convertable to the same types
// and equal.
//
// assert.EqualValues(uint32(123), int32(123), "123 and 123 should be equal")
//
// Returns whether the assertion was successful (true) or not (false).
func (a *Assertions) EqualValues(expected, actual interface{}, msgAndArgs ...interface{}) bool {
return EqualValues(a.t, expected, actual, msgAndArgs...)
}
// Exactly asserts that two objects are equal is value and type.
//
// assert.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal")

View File

@ -50,6 +50,14 @@ func TestEqualWrapper(t *testing.T) {
}
}
func TestEqualValuesWrapper(t *testing.T) {
assert := New(new(testing.T))
if !assert.EqualValues(uint32(10), int32(10)) {
t.Error("EqualValues should return true")
}
}
func TestNotNilWrapper(t *testing.T) {
assert := New(new(testing.T))