MCPcopy Index your code
hub / github.com/expr-lang/expr / TestErrorAs

Function TestErrorAs

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

Source from the content-addressed store, hash-verified

3133}
3134
3135func TestErrorAs(t *testing.T) {
3136 mockT := new(testing.T)
3137 tests := []struct {
3138 err error
3139 result bool
3140 }{
3141 {fmt.Errorf("wrap: %w", &customError{}), true},
3142 {io.EOF, false},
3143 {nil, false},
3144 }
3145 for _, tt := range tests {
3146 tt := tt
3147 var target *customError
3148 t.Run(fmt.Sprintf("ErrorAs(%#v,%#v)", tt.err, target), func(t *testing.T) {
3149 res := ErrorAs(mockT, tt.err, &target)
3150 if res != tt.result {
3151 t.Errorf("ErrorAs(%#v,%#v) should return %t)", tt.err, target, tt.result)
3152 }
3153 })
3154 }
3155}

Callers

nothing calls this directly

Calls 4

RunMethod · 0.80
SprintfMethod · 0.80
ErrorAsFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…