dereference target

pull/1345/head
Craig Davison 2025-01-03 14:34:16 -07:00
parent 1c717c00c1
commit c60c3bd7fb
2 changed files with 8 additions and 8 deletions

View File

@ -2146,8 +2146,8 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{
chain := buildErrorChainString(err, true) chain := buildErrorChainString(err, true)
return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ return Fail(t, fmt.Sprintf("Should be in error chain:\n"+
"expected: %T\n"+ "expected: %s\n"+
"in chain: %s", target, chain, "in chain: %s", reflect.ValueOf(target).Elem().Type(), chain,
), msgAndArgs...) ), msgAndArgs...)
} }
@ -2164,8 +2164,8 @@ func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interfa
chain := buildErrorChainString(err, true) chain := buildErrorChainString(err, true)
return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+
"found: %T\n"+ "found: %s\n"+
"in chain: %s", target, chain, "in chain: %s", reflect.ValueOf(target).Elem().Type(), chain,
), msgAndArgs...) ), msgAndArgs...)
} }

View File

@ -3367,7 +3367,7 @@ func TestErrorAs(t *testing.T) {
result: false, result: false,
resultErrMsg: "" + resultErrMsg: "" +
"Should be in error chain:\n" + "Should be in error chain:\n" +
"expected: **assert.customError\n" + "expected: *assert.customError\n" +
"in chain: \"EOF\" (*errors.errorString)\n", "in chain: \"EOF\" (*errors.errorString)\n",
}, },
{ {
@ -3375,7 +3375,7 @@ func TestErrorAs(t *testing.T) {
result: false, result: false,
resultErrMsg: "" + resultErrMsg: "" +
"Should be in error chain:\n" + "Should be in error chain:\n" +
"expected: **assert.customError\n" + "expected: *assert.customError\n" +
"in chain: \n", "in chain: \n",
}, },
{ {
@ -3383,7 +3383,7 @@ func TestErrorAs(t *testing.T) {
result: false, result: false,
resultErrMsg: "" + resultErrMsg: "" +
"Should be in error chain:\n" + "Should be in error chain:\n" +
"expected: **assert.customError\n" + "expected: *assert.customError\n" +
"in chain: \"abc: def\" (*fmt.wrapError)\n" + "in chain: \"abc: def\" (*fmt.wrapError)\n" +
"\t\"def\" (*errors.errorString)\n", "\t\"def\" (*errors.errorString)\n",
}, },
@ -3410,7 +3410,7 @@ func TestNotErrorAs(t *testing.T) {
result: false, result: false,
resultErrMsg: "" + resultErrMsg: "" +
"Target error should not be in err chain:\n" + "Target error should not be in err chain:\n" +
"found: **assert.customError\n" + "found: *assert.customError\n" +
"in chain: \"wrap: fail\" (*fmt.wrapError)\n" + "in chain: \"wrap: fail\" (*fmt.wrapError)\n" +
"\t\"fail\" (*assert.customError)\n", "\t\"fail\" (*assert.customError)\n",
}, },