1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Use args struct for RunTests

There were too many position arguments
This commit is contained in:
Jesse Duffield
2023-11-29 11:39:10 +11:00
parent d8059d7f7d
commit 7e5f25e415
4 changed files with 53 additions and 52 deletions

View File

@@ -29,17 +29,17 @@ func RunCLI(testNames []string, slow bool, sandbox bool, waitForDebugger bool, r
inputDelay = SLOW_INPUT_DELAY
}
err := components.RunTests(
getTestsToRun(testNames),
log.Printf,
runCmdInTerminal,
runAndPrintFatalError,
sandbox,
waitForDebugger,
raceDetector,
inputDelay,
1,
)
err := components.RunTests(components.RunTestArgs{
Tests: getTestsToRun(testNames),
Logf: log.Printf,
RunCmd: runCmdInTerminal,
TestWrapper: runAndPrintFatalError,
Sandbox: sandbox,
WaitForDebugger: waitForDebugger,
RaceDetector: raceDetector,
InputDelay: inputDelay,
MaxAttempts: 1,
})
if err != nil {
log.Print(err.Error())
}

View File

@@ -30,11 +30,11 @@ func TestIntegration(t *testing.T) {
raceDetector := os.Getenv("LAZYGIT_RACE_DETECTOR") != ""
testNumber := 0
err := components.RunTests(
tests.GetTests(),
t.Logf,
runCmdHeadless,
func(test *components.IntegrationTest, f func() error) {
err := components.RunTests(components.RunTestArgs{
Tests: tests.GetTests(),
Logf: t.Logf,
RunCmd: runCmdHeadless,
TestWrapper: func(test *components.IntegrationTest, f func() error) {
defer func() { testNumber += 1 }()
if testNumber%parallelTotal != parallelIndex {
return
@@ -52,13 +52,13 @@ func TestIntegration(t *testing.T) {
assert.NoError(t, err)
})
},
false,
false,
raceDetector,
0,
Sandbox: false,
WaitForDebugger: false,
RaceDetector: raceDetector,
InputDelay: 0,
// Allow two attempts at each test to get around flakiness
2,
)
MaxAttempts: 2,
})
assert.NoError(t, err)
}

View File

@@ -385,17 +385,17 @@ func quit(g *gocui.Gui, v *gocui.View) error {
}
func runTuiTest(test *components.IntegrationTest, sandbox bool, waitForDebugger bool, raceDetector bool, inputDelay int) {
err := components.RunTests(
[]*components.IntegrationTest{test},
log.Printf,
runCmdInTerminal,
runAndPrintError,
sandbox,
waitForDebugger,
raceDetector,
inputDelay,
1,
)
err := components.RunTests(components.RunTestArgs{
Tests: []*components.IntegrationTest{test},
Logf: log.Printf,
RunCmd: runCmdInTerminal,
TestWrapper: runAndPrintError,
Sandbox: sandbox,
WaitForDebugger: waitForDebugger,
RaceDetector: raceDetector,
InputDelay: inputDelay,
MaxAttempts: 1,
})
if err != nil {
log.Println(err.Error())
}