MCPcopy
hub / github.com/stretchr/testify / TestNotErrorAs

Function TestNotErrorAs

assert/assertions_test.go:3882–3917  ·  assert/assertions_test.go::TestNotErrorAs
(t *testing.T)

Source from the content-addressed store, hash-verified

3880}
3881
3882func TestNotErrorAs(t *testing.T) {
3883 t.Parallel()
3884
3885 tests := []struct {
3886 err error
3887 result bool
3888 resultErrMsg string
3889 }{
3890 {
3891 err: fmt.Errorf("wrap: %w", &customError{}),
3892 result: false,
3893 resultErrMsg: "" +
3894 "Target error should not be in err chain:\n" +
3895 "found: *assert.customError\n" +
3896 "in chain: \"wrap: fail\" (*fmt.wrapError)\n" +
3897 "\t\"fail\" (*assert.customError)\n",
3898 },
3899 {
3900 err: io.EOF,
3901 result: true,
3902 },
3903 {
3904 err: nil,
3905 result: true,
3906 },
3907 }
3908 for _, tt := range tests {
3909 tt := tt
3910 var target *customError
3911 t.Run(fmt.Sprintf("NotErrorAs(%#v,%#v)", tt.err, target), func(t *testing.T) {
3912 mockT := new(captureTestingT)
3913 res := NotErrorAs(mockT, tt.err, &target)
3914 mockT.checkResultAndErrMsg(t, tt.result, res, tt.resultErrMsg)
3915 })
3916 }
3917}

Callers

nothing calls this directly

Calls 4

checkResultAndErrMsgMethod · 0.80
NotErrorAsFunction · 0.70
ErrorfMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected