Skip to content

Commit

Permalink
fix non comparable error check
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Jan 8, 2024
1 parent 0a754fa commit dd585ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
12 changes: 12 additions & 0 deletions assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

0 comments on commit dd585ae

Please sign in to comment.