aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/stretchr/testify/assert/assertions.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/stretchr/testify/assert/assertions.go')
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertions.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go
index d7c16c5..348d5f1 100644
--- a/vendor/github.com/stretchr/testify/assert/assertions.go
+++ b/vendor/github.com/stretchr/testify/assert/assertions.go
@@ -832,11 +832,11 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m
//
// Returns whether the assertion was successful (true) or not (false).
func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
- if isNil(err) {
- return true
+ if err != nil {
+ return Fail(t, fmt.Sprintf("Received unexpected error %q", err), msgAndArgs...)
}
- return Fail(t, fmt.Sprintf("Received unexpected error %q", err), msgAndArgs...)
+ return true
}
// Error asserts that a function returned an error (i.e. not `nil`).
@@ -850,8 +850,11 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
message := messageFromMsgAndArgs(msgAndArgs...)
- return NotNil(t, err, "An error is expected but got nil. %s", message)
+ if err == nil {
+ return Fail(t, "An error is expected but got nil. %s", message)
+ }
+ return true
}
// EqualError asserts that a function returned an error (i.e. not `nil`)