aboutsummaryrefslogtreecommitdiff
path: root/assert/errequal_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'assert/errequal_test.go')
-rw-r--r--assert/errequal_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/assert/errequal_test.go b/assert/errequal_test.go
index 5efbdc5..4bb9080 100644
--- a/assert/errequal_test.go
+++ b/assert/errequal_test.go
@@ -74,4 +74,18 @@ func TestErrEqual(t *testing.T) {
Outcome: testcapture.OutcomePanicked,
Panic: "cannot handle `expected` of type int",
})
+
+ // an earlier version had a bug because this call caused reflect.Value.IsNil() to be called on a value of kind Struct
+ expectErrors(t, func(t assert.TestingTB) {
+ assert.ErrEqual(t, nil, structTypedError{"foo"})
+ }, `expected "foo", but got no error`)
+}
+
+type structTypedError struct {
+ Message string
+}
+
+// Error implements the builtin/error interface.
+func (e structTypedError) Error() string {
+ return e.Message
}