1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-23 16:22:24 +03:00
This commit is contained in:
Jesse Duffield
2021-12-07 21:59:36 +11:00
parent 157dd309f7
commit b4c078d565
48 changed files with 437 additions and 493 deletions

View File

@@ -45,7 +45,7 @@ func RunTests(
testDir := filepath.Join(rootDir, "test", "integration")
osCommand := oscommands.NewDummyOSCommand()
err = osCommand.RunCommand("go build -o %s", tempLazygitPath())
err = osCommand.Run(osCommand.NewCmdObj("go build -o " + tempLazygitPath()))
if err != nil {
return err
}
@@ -216,11 +216,10 @@ func GetRootDirectory() string {
}
func createFixture(testPath, actualDir string) error {
osCommand := oscommands.NewDummyOSCommand()
bashScriptPath := filepath.Join(testPath, "setup.sh")
cmd := secureexec.Command("bash", bashScriptPath, actualDir)
if err := osCommand.RunExecutable(cmd); err != nil {
if _, err := cmd.CombinedOutput(); err != nil {
return err
}
@@ -320,7 +319,7 @@ func generateSnapshot(dir string) (string, error) {
for _, cmdStr := range cmdStrs {
// ignoring error for now. If there's an error it could be that there are no results
output, _ := osCommand.RunCommandWithOutput(cmdStr)
output, _ := osCommand.RunWithOutput(osCommand.NewCmdObj(cmdStr))
snapshot += output + "\n"
}
@@ -429,22 +428,16 @@ func getLazygitCommand(testPath string, rootDir string, record bool, speed float
cmdStr := fmt.Sprintf("%s -debug --use-config-dir=%s --path=%s %s", tempLazygitPath(), configDir, actualDir, extraCmdArgs)
cmd := osCommand.ExecutableFromString(cmdStr)
cmd.Env = append(cmd.Env, fmt.Sprintf("SPEED=%f", speed))
cmdObj := osCommand.NewCmdObj(cmdStr)
cmdObj.AddEnvVars(fmt.Sprintf("SPEED=%f", speed))
if record {
cmd.Env = append(
cmd.Env,
fmt.Sprintf("RECORD_EVENTS_TO=%s", replayPath),
)
cmdObj.AddEnvVars(fmt.Sprintf("RECORD_EVENTS_TO=%s", replayPath))
} else {
cmd.Env = append(
cmd.Env,
fmt.Sprintf("REPLAY_EVENTS_FROM=%s", replayPath),
)
cmdObj.AddEnvVars(fmt.Sprintf("REPLAY_EVENTS_FROM=%s", replayPath))
}
return cmd, nil
return cmdObj.GetCmd(), nil
}
func folderExists(path string) bool {