diff --git a/assertions.go b/assertions.go index 6e259db..3de595d 100644 --- a/assertions.go +++ b/assertions.go @@ -301,7 +301,7 @@ func (as Assertions) Is(x, y interface{}) { if ae, ok := x.(error); ok { if be, ok := y.(error); ok { - if ae == be { + if utils.SmartCompare(ae, be) == 0 { return } diff --git a/assertions_test.go b/assertions_test.go index 9417ba5..b20733f 100644 --- a/assertions_test.go +++ b/assertions_test.go @@ -320,3 +320,15 @@ func TestCustomAssertionError(t *testing.T) { g.Eq(1, 2) m.check("custom eq") } + +type rawErr []byte + +func (r rawErr) Error() string { + return string(r) +} + +func TestIsRawErr(t *testing.T) { + g := got.T(t) + + g.Is(rawErr("ok"), rawErr("ok")) +}