MCPcopy Index your code
hub / github.com/bracesdev/errtrace / TestWrappedErrorAs

Function TestWrappedErrorAs

errtrace_test.go:44–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestWrappedErrorAs(t *testing.T) {
45 err := errtrace.Wrap(&myError{x: 42})
46 var m *myError
47 if !errors.As(err, &m) {
48 t.Errorf("As(): want true, got false")
49 }
50
51 if want, got := 42, m.x; want != got {
52 t.Errorf("As(): want %d, got %d", want, got)
53 }
54}
55
56func TestFormatTrace(t *testing.T) {
57 orig := errors.New("foo")

Callers

nothing calls this directly

Calls 1

WrapFunction · 0.92

Tested by

no test coverage detected