Skip to content

Commit

Permalink
stretchr#562: assert.NoError() and assert.Error() now behave correctl…
Browse files Browse the repository at this point in the history
…y when a nil error struct is supplied
  • Loading branch information
e-nikolov committed Oct 3, 2019
1 parent 85f2b59 commit d1a1769
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if err != nil {
if !isNil(err) {
return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...)
}

Expand All @@ -1215,7 +1215,7 @@ func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
h.Helper()
}

if err == nil {
if isNil(err) {
return Fail(t, "An error is expected but got nil.", msgAndArgs...)
}

Expand Down

0 comments on commit d1a1769

Please sign in to comment.