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

Function TestWrapError

error_test.go:156–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

154}
155
156func TestWrapError(t *testing.T) {
157
158 e := func() error {
159 return Wrap("hi", 1)
160 }()
161
162 if e.Error() != "hi" {
163 t.Errorf("Constructor with a string failed")
164 }
165
166 if Wrap(fmt.Errorf("yo"), 0).Error() != "yo" {
167 t.Errorf("Constructor with an error failed")
168 }
169
170 if Wrap(e, 0) != e {
171 t.Errorf("Constructor with an Error failed")
172 }
173
174 if Wrap(nil, 0) != nil {
175 t.Errorf("Constructor with nil failed")
176 }
177}
178
179func TestWrapPrefixError(t *testing.T) {
180

Callers

nothing calls this directly

Calls 2

WrapFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…