diff --git a/assert/assertions.go b/assert/assertions.go index 4efe1de..be82161 100644 --- a/assert/assertions.go +++ b/assert/assertions.go @@ -2146,8 +2146,8 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{ chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %T\n"+ - "in chain: %s", target, chain, + "expected: %s\n"+ + "in chain: %s", reflect.ValueOf(target).Elem().Type(), chain, ), msgAndArgs...) } @@ -2164,8 +2164,8 @@ func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interfa chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %T\n"+ - "in chain: %s", target, chain, + "found: %s\n"+ + "in chain: %s", reflect.ValueOf(target).Elem().Type(), chain, ), msgAndArgs...) } diff --git a/assert/assertions_test.go b/assert/assertions_test.go index bb6af1b..503eadb 100644 --- a/assert/assertions_test.go +++ b/assert/assertions_test.go @@ -3367,7 +3367,7 @@ func TestErrorAs(t *testing.T) { result: false, resultErrMsg: "" + "Should be in error chain:\n" + - "expected: **assert.customError\n" + + "expected: *assert.customError\n" + "in chain: \"EOF\" (*errors.errorString)\n", }, { @@ -3375,7 +3375,7 @@ func TestErrorAs(t *testing.T) { result: false, resultErrMsg: "" + "Should be in error chain:\n" + - "expected: **assert.customError\n" + + "expected: *assert.customError\n" + "in chain: \n", }, { @@ -3383,7 +3383,7 @@ func TestErrorAs(t *testing.T) { result: false, resultErrMsg: "" + "Should be in error chain:\n" + - "expected: **assert.customError\n" + + "expected: *assert.customError\n" + "in chain: \"abc: def\" (*fmt.wrapError)\n" + "\t\"def\" (*errors.errorString)\n", }, @@ -3410,7 +3410,7 @@ func TestNotErrorAs(t *testing.T) { result: false, resultErrMsg: "" + "Target error should not be in err chain:\n" + - "found: **assert.customError\n" + + "found: *assert.customError\n" + "in chain: \"wrap: fail\" (*fmt.wrapError)\n" + "\t\"fail\" (*assert.customError)\n", },