(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestPanic(t *testing.T) { |
| 110 | setupCleanup(t) |
| 111 | |
| 112 | ctx, cancel := context.WithCancel(context.Background()) |
| 113 | defer cancel() |
| 114 | |
| 115 | ctx = cli.ContextWithConfig(ctx, &cli.Config{ |
| 116 | NonInteractive: true, |
| 117 | Test: cli.ConfigTest{ |
| 118 | Browserless: true, |
| 119 | Timestamp: Timestamp, |
| 120 | }, |
| 121 | }) |
| 122 | |
| 123 | t.Run(fmt.Sprintf("golden-%s", uitest.TestTagOS()), func(t *testing.T) { |
| 124 | drv, tm := uitest.TestTUI(ctx, t) |
| 125 | |
| 126 | cmd := PanicCommand{} |
| 127 | err := stacktrace.CapturePanic(func() error { return cmd.UI().RunTUI(ctx, drv) }) |
| 128 | |
| 129 | if want, got := "test panic", err.Error(); want != got { |
| 130 | t.Fatalf("want return err %q, got %q", want, got) |
| 131 | } |
| 132 | |
| 133 | cli.ReportError(ctx, err, drv, CmdError, nil) |
| 134 | |
| 135 | drv.Program.Quit() |
| 136 | |
| 137 | tm.WaitFinished(t, teatest.WithFinalTimeout(time.Second*3)) |
| 138 | uitest.TestGolden(t, drv.Golden()) |
| 139 | }) |
| 140 | } |
| 141 | |
| 142 | type TestHeader struct { |
| 143 | Type string |
nothing calls this directly
no test coverage detected