Skip to content

Commit dd585ae

Browse files
committed
fix non comparable error check
1 parent 0a754fa commit dd585ae

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

assertions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (as Assertions) Is(x, y interface{}) {
301301

302302
if ae, ok := x.(error); ok {
303303
if be, ok := y.(error); ok {
304-
if ae == be {
304+
if utils.SmartCompare(ae, be) == 0 {
305305
return
306306
}
307307

assertions_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,15 @@ func TestCustomAssertionError(t *testing.T) {
320320
g.Eq(1, 2)
321321
m.check("custom eq")
322322
}
323+
324+
type rawErr []byte
325+
326+
func (r rawErr) Error() string {
327+
return string(r)
328+
}
329+
330+
func TestIsRawErr(t *testing.T) {
331+
g := got.T(t)
332+
333+
g.Is(rawErr("ok"), rawErr("ok"))
334+
}

0 commit comments

Comments
 (0)