| 112 | } |
| 113 | |
| 114 | func 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 | |
| 141 | func TestF(t *testing.T) { |
| 142 | buf := new(strings.Builder) |