MCPcopy Create free account
hub / github.com/dsnet/try / TestFrame

Function TestFrame

try_test.go:114–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func TestFrame(t *testing.T) {
115 t.Run("E", func(t *testing.T) {
116 defer try.Recover(func(err error, frame runtime.Frame) {
117 if frame.File != "x.go" {
118 t.Errorf("want File=x.go, got %q", frame.File)
119 }
120 if frame.Line != 4 {
121 t.Errorf("want Line=4, got %d", frame.Line)
122 }
123 })
124//line x.go:4
125 try.E(errors.New("crash and burn"))
126 })
127 t.Run("E3", func(t *testing.T) {
128 defer try.Recover(func(err error, frame runtime.Frame) {
129 if frame.File != "x.go" {
130 t.Errorf("want File=x.go, got %q", frame.File)
131 }
132 if frame.Line != 4 {
133 t.Errorf("want Line=4, got %d", frame.Line)
134 }
135 })
136//line x.go:4
137 try.E3(failure())
138 })
139}
140
141func TestF(t *testing.T) {
142 buf := new(strings.Builder)

Callers

nothing calls this directly

Calls 4

RecoverFunction · 0.92
EFunction · 0.92
E3Function · 0.92
failureFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…