mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
support passing extra command args in integration tests
This commit is contained in:
parent
43a9dc48e0
commit
27525f1d42
@ -15,9 +15,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Test struct {
|
type Test struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Speed float64 `json:"speed"`
|
Speed float64 `json:"speed"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
ExtraCmdArgs string `json:"extraCmdArgs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function is used by both `go test` and from our lazyintegration gui, but
|
// this function is used by both `go test` and from our lazyintegration gui, but
|
||||||
@ -75,7 +76,7 @@ func RunTests(
|
|||||||
|
|
||||||
configDir := filepath.Join(testPath, "used_config")
|
configDir := filepath.Join(testPath, "used_config")
|
||||||
|
|
||||||
cmd, err := getLazygitCommand(testPath, rootDir, record, speed)
|
cmd, err := getLazygitCommand(testPath, rootDir, record, speed, test.ExtraCmdArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -338,7 +339,7 @@ func generateSnapshots(actualDir string, expectedDir string) (string, string, er
|
|||||||
return actual, expected, nil
|
return actual, expected, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLazygitCommand(testPath string, rootDir string, record bool, speed float64) (*exec.Cmd, error) {
|
func getLazygitCommand(testPath string, rootDir string, record bool, speed float64, extraCmdArgs string) (*exec.Cmd, error) {
|
||||||
osCommand := oscommands.NewDummyOSCommand()
|
osCommand := oscommands.NewDummyOSCommand()
|
||||||
|
|
||||||
replayPath := filepath.Join(testPath, "recording.json")
|
replayPath := filepath.Join(testPath, "recording.json")
|
||||||
@ -365,7 +366,7 @@ func getLazygitCommand(testPath string, rootDir string, record bool, speed float
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdStr := fmt.Sprintf("%s -debug --use-config-dir=%s --path=%s", tempLazygitPath(), configDir, actualDir)
|
cmdStr := fmt.Sprintf("%s -debug --use-config-dir=%s --path=%s %s", tempLazygitPath(), configDir, actualDir, extraCmdArgs)
|
||||||
|
|
||||||
cmd := osCommand.ExecutableFromString(cmdStr)
|
cmd := osCommand.ExecutableFromString(cmdStr)
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("SPEED=%f", speed))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("SPEED=%f", speed))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user