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

Function TestNotErrorIs

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

Source from the content-addressed store, hash-verified

3764}
3765
3766func TestNotErrorIs(t *testing.T) {
3767 t.Parallel()
3768
3769 tests := []struct {
3770 err error
3771 target error
3772 result bool
3773 resultErrMsg string
3774 }{
3775 {
3776 err: io.EOF,
3777 target: io.EOF,
3778 result: false,
3779 resultErrMsg: "" +
3780 "Target error should not be in err chain:\n" +
3781 "found: \"EOF\"\n" +
3782 "in chain: \"EOF\"\n",
3783 },
3784 {
3785 err: fmt.Errorf("wrap: %w", io.EOF),
3786 target: io.EOF,
3787 result: false,
3788 resultErrMsg: "" +
3789 "Target error should not be in err chain:\n" +
3790 "found: \"EOF\"\n" +
3791 "in chain: \"wrap: EOF\"\n" +
3792 "\t\"EOF\"\n",
3793 },
3794 {
3795 err: io.EOF,
3796 target: io.ErrClosedPipe,
3797 result: true,
3798 },
3799 {
3800 err: nil,
3801 target: io.EOF,
3802 result: true,
3803 },
3804 {
3805 err: io.EOF,
3806 target: nil,
3807 result: true,
3808 },
3809 {
3810 err: nil,
3811 target: nil,
3812 result: false,
3813 resultErrMsg: "" +
3814 "Target error should not be in err chain:\n" +
3815 "found: \"\"\n" +
3816 "in chain: \n",
3817 },
3818 {
3819 err: fmt.Errorf("abc: %w", errors.New("def")),
3820 target: io.EOF,
3821 result: true,
3822 },
3823 }

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected