MCPcopy
hub / github.com/expr-lang/expr / TestErrorIs

Function TestErrorIs

internal/testify/assert/assertions_test.go:2999–3067  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2997}
2998
2999func TestErrorIs(t *testing.T) {
3000 tests := []struct {
3001 err error
3002 target error
3003 result bool
3004 resultErrMsg string
3005 }{
3006 {
3007 err: io.EOF,
3008 target: io.EOF,
3009 result: true,
3010 },
3011 {
3012 err: fmt.Errorf("wrap: %w", io.EOF),
3013 target: io.EOF,
3014 result: true,
3015 },
3016 {
3017 err: io.EOF,
3018 target: io.ErrClosedPipe,
3019 result: false,
3020 resultErrMsg: "" +
3021 "Target error should be in err chain:\n" +
3022 "expected: \"io: read/write on closed pipe\"\n" +
3023 "in chain: \"EOF\"\n",
3024 },
3025 {
3026 err: nil,
3027 target: io.EOF,
3028 result: false,
3029 resultErrMsg: "" +
3030 "Target error should be in err chain:\n" +
3031 "expected: \"EOF\"\n" +
3032 "in chain: \n",
3033 },
3034 {
3035 err: io.EOF,
3036 target: nil,
3037 result: false,
3038 resultErrMsg: "" +
3039 "Target error should be in err chain:\n" +
3040 "expected: \"\"\n" +
3041 "in chain: \"EOF\"\n",
3042 },
3043 {
3044 err: nil,
3045 target: nil,
3046 result: true,
3047 },
3048 {
3049 err: fmt.Errorf("abc: %w", errors.New("def")),
3050 target: io.EOF,
3051 result: false,
3052 resultErrMsg: "" +
3053 "Target error should be in err chain:\n" +
3054 "expected: \"EOF\"\n" +
3055 "in chain: \"abc: def\"\n" +
3056 "\t\"def\"\n",

Callers

nothing calls this directly

Calls 5

RunMethod · 0.80
SprintfMethod · 0.80
checkResultAndErrMsgMethod · 0.80
ErrorIsFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…