MCPcopy Index your code
hub / github.com/go-errors/errors / TestIs

Function TestIs

error_test.go:134–154  ·  view source on GitHub ↗

This test should work for any go version

(t *testing.T)

Source from the content-addressed store, hash-verified

132
133// This test should work for any go version
134func TestIs(t *testing.T) {
135 if Is(nil, io.EOF) {
136 t.Errorf("nil is an error")
137 }
138
139 if !Is(io.EOF, io.EOF) {
140 t.Errorf("io.EOF is not io.EOF")
141 }
142
143 if !Is(io.EOF, New(io.EOF)) {
144 t.Errorf("io.EOF is not New(io.EOF)")
145 }
146
147 if !Is(New(io.EOF), New(io.EOF)) {
148 t.Errorf("New(io.EOF) is not New(io.EOF)")
149 }
150
151 if Is(io.EOF, fmt.Errorf("io.EOF")) {
152 t.Errorf("io.EOF is fmt.Errorf")
153 }
154}
155
156func TestWrapError(t *testing.T) {
157

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
IsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…