diff --git a/assert/assertions_test.go b/assert/assertions_test.go index 3ed3ebad8..e83e3867e 100644 --- a/assert/assertions_test.go +++ b/assert/assertions_test.go @@ -3130,21 +3130,24 @@ func TestErrorAs(t *testing.T) { { err: io.EOF, result: false, - resultErrMsg: "Should be in error chain:\n" + + resultErrMsg: "" + + "Should be in error chain:\n" + "expected: **assert.customError\n" + "in chain: \"EOF\" (*errors.errorString)\n", }, { err: nil, result: false, - resultErrMsg: "Should be in error chain:\n" + + resultErrMsg: "" + + "Should be in error chain:\n" + "expected: **assert.customError\n" + "in chain: \n", }, { err: fmt.Errorf("abc: %w", errors.New("def")), result: false, - resultErrMsg: "Should be in error chain:\n" + + resultErrMsg: "" + + "Should be in error chain:\n" + "expected: **assert.customError\n" + "in chain: \"abc: def\" (*fmt.wrapError)\n" + "\t\"def\" (*errors.errorString)\n", @@ -3152,9 +3155,9 @@ func TestErrorAs(t *testing.T) { } for _, tt := range tests { tt := tt - mockT := new(captureTestingT) var target *customError t.Run(fmt.Sprintf("ErrorAs(%#v,%#v)", tt.err, target), func(t *testing.T) { + mockT := new(captureTestingT) res := ErrorAs(mockT, tt.err, &target) mockT.checkResultAndErrMsg(t, tt.result, res, tt.resultErrMsg) })