(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestError(t *testing.T) { |
| 63 | setupCleanup(t) |
| 64 | |
| 65 | ctx, cancel := context.WithCancel(context.Background()) |
| 66 | defer cancel() |
| 67 | |
| 68 | ctx = cli.ContextWithConfig(ctx, &cli.Config{ |
| 69 | NonInteractive: true, |
| 70 | Test: cli.ConfigTest{ |
| 71 | Browserless: true, |
| 72 | Timestamp: Timestamp, |
| 73 | }, |
| 74 | }) |
| 75 | |
| 76 | t.Run(fmt.Sprintf("golden-%s", uitest.TestTagOS()), func(t *testing.T) { |
| 77 | drv, tm := uitest.TestTUI(ctx, t) |
| 78 | |
| 79 | cmd := ErrorCommand{} |
| 80 | err := stacktrace.CapturePanic(func() error { return cmd.UI().RunTUI(ctx, drv) }) |
| 81 | |
| 82 | if want, got := testErr, err; !reflect.DeepEqual(want, got) { |
| 83 | t.Fatalf("want return err %+v, got %+v", want, got) |
| 84 | } |
| 85 | |
| 86 | cli.ReportError(ctx, err, drv, CmdError, nil) |
| 87 | |
| 88 | drv.Program.Quit() |
| 89 | |
| 90 | tm.WaitFinished(t, teatest.WithFinalTimeout(time.Second*3)) |
| 91 | uitest.TestGolden(t, drv.Golden()) |
| 92 | }) |
| 93 | } |
| 94 | |
| 95 | type PanicCommand struct{} |
| 96 |
nothing calls this directly
no test coverage detected