MCPcopy Create free account
hub / github.com/stretchr/testify / TestNotErrorIs

Function TestNotErrorIs

assert/assertions_test.go:3283–3347  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3281}
3282
3283func TestNotErrorIs(t *testing.T) {
3284 tests := []struct {
3285 err error
3286 target error
3287 result bool
3288 resultErrMsg string
3289 }{
3290 {
3291 err: io.EOF,
3292 target: io.EOF,
3293 result: false,
3294 resultErrMsg: "" +
3295 "Target error should not be in err chain:\n" +
3296 "found: \"EOF\"\n" +
3297 "in chain: \"EOF\"\n",
3298 },
3299 {
3300 err: fmt.Errorf("wrap: %w", io.EOF),
3301 target: io.EOF,
3302 result: false,
3303 resultErrMsg: "" +
3304 "Target error should not be in err chain:\n" +
3305 "found: \"EOF\"\n" +
3306 "in chain: \"wrap: EOF\"\n" +
3307 "\t\"EOF\"\n",
3308 },
3309 {
3310 err: io.EOF,
3311 target: io.ErrClosedPipe,
3312 result: true,
3313 },
3314 {
3315 err: nil,
3316 target: io.EOF,
3317 result: true,
3318 },
3319 {
3320 err: io.EOF,
3321 target: nil,
3322 result: true,
3323 },
3324 {
3325 err: nil,
3326 target: nil,
3327 result: false,
3328 resultErrMsg: "" +
3329 "Target error should not be in err chain:\n" +
3330 "found: \"\"\n" +
3331 "in chain: \n",
3332 },
3333 {
3334 err: fmt.Errorf("abc: %w", errors.New("def")),
3335 target: io.EOF,
3336 result: true,
3337 },
3338 }
3339 for _, tt := range tests {
3340 tt := tt

Callers

nothing calls this directly

Calls 4

checkResultAndErrMsgMethod · 0.80
NotErrorIsFunction · 0.70
ErrorfMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected