Skip to content

Commit

Permalink
error-compare: allow ErrorContains and ErrorEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorel-35 authored Jun 30, 2024
1 parent 8afa731 commit b9c9cb1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,15 @@ Describe a new checker in [checkers section](./README.md#checkers).
### error-compare

```go
❌ assert.ErrorContains(t, err, "not found")
assert.EqualError(t, err, "user not found")
❌ assert.Contains(t, err.Error(), "not found")
assert.Equal(t, err.Error(), "user not found")
assert.Equal(t, err, errSentinel) // Through `reflect.DeepEqual` causes error strings to be compared.
assert.NotEqual(t, err, errSentinel)
// etc.

✅ assert.ErrorIs(t, err, ErrUserNotFound)
✅ assert.ErrorContains(t, err, "not found")
assert.EqualError(t, err, "user not found")
assert.ErrorIs(t, err, ErrUserNotFound)
```

**Autofix**: false. <br>
Expand Down

0 comments on commit b9c9cb1

Please sign in to comment.