(raceDetector bool)
| 23 | var SLOW_INPUT_DELAY = 600 |
| 24 | |
| 25 | func RunTUI(raceDetector bool) { |
| 26 | rootDir := utils.GetLazyRootDirectory() |
| 27 | testDir := filepath.Join(rootDir, "test", "integration") |
| 28 | |
| 29 | app := newApp(testDir) |
| 30 | app.loadTests() |
| 31 | |
| 32 | g, err := gocui.NewGui(gocui.NewGuiOpts{ |
| 33 | OutputMode: gocui.OutputTrue, |
| 34 | RuneReplacements: gui.RuneReplacements, |
| 35 | }) |
| 36 | if err != nil { |
| 37 | log.Panicln(err) |
| 38 | } |
| 39 | |
| 40 | g.Cursor = false |
| 41 | |
| 42 | app.g = g |
| 43 | |
| 44 | g.SetManagerFunc(app.layout) |
| 45 | |
| 46 | g.SetKeybinding("list", gocui.NewKeyName(gocui.KeyArrowUp), func(*gocui.Gui, *gocui.View) error { |
| 47 | if app.itemIdx > 0 { |
| 48 | app.itemIdx-- |
| 49 | } |
| 50 | listView, err := g.View("list") |
| 51 | if err != nil { |
| 52 | return err |
| 53 | } |
| 54 | listView.FocusPoint(0, app.itemIdx, true) |
| 55 | return nil |
| 56 | }) |
| 57 | |
| 58 | g.SetKeybinding("list", gocui.NewKeyName(gocui.KeyArrowDown), func(*gocui.Gui, *gocui.View) error { |
| 59 | if app.itemIdx < len(app.filteredTests)-1 { |
| 60 | app.itemIdx++ |
| 61 | } |
| 62 | |
| 63 | listView, err := g.View("list") |
| 64 | if err != nil { |
| 65 | return err |
| 66 | } |
| 67 | listView.FocusPoint(0, app.itemIdx, true) |
| 68 | return nil |
| 69 | }) |
| 70 | |
| 71 | g.SetKeybinding("list", gocui.NewKeyStrMod("c", gocui.ModCtrl), quit) |
| 72 | |
| 73 | g.SetKeybinding("list", gocui.NewKeyRune('q'), quit) |
| 74 | |
| 75 | g.SetKeybinding("list", gocui.NewKeyRune('s'), func(*gocui.Gui, *gocui.View) error { |
| 76 | currentTest := app.getCurrentTest() |
| 77 | if currentTest == nil { |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | suspendAndRunTest(currentTest, true, false, raceDetector, 0) |
| 82 |
no test coverage detected