MCPcopy
hub / github.com/tinylib/msgp / TestWrapVanillaErrorWithAdditionalContext

Function TestWrapVanillaErrorWithAdditionalContext

msgp/errors_test.go:25–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestWrapVanillaErrorWithAdditionalContext(t *testing.T) {
26 err := errors.New("test")
27 w := WrapError(err, "foo", "bar")
28 if w == err {
29 t.Fatal()
30 }
31 if w.Error() == err.Error() {
32 t.Fatal()
33 }
34 if w.(Error).Resumable() {
35 t.Fatal()
36 }
37 if !strings.HasPrefix(w.Error(), err.Error()) {
38 t.Fatal()
39 }
40 rest := w.Error()[len(err.Error()):]
41 if rest != " at foo/bar" {
42 t.Fatal()
43 }
44}
45
46func TestWrapResumableError(t *testing.T) {
47 err := ArrayError{}

Callers

nothing calls this directly

Calls 3

WrapErrorFunction · 0.85
ResumableMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…