mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
discard changes integration test
This commit is contained in:
parent
7c7f7bf9b9
commit
5c11b1ecb7
64 changed files with 153 additions and 145 deletions
|
@ -35,6 +35,32 @@ func (s *Shell) RunCommand(cmdStr string) *Shell {
|
|||
return s
|
||||
}
|
||||
|
||||
func (s *Shell) RunShellCommand(cmdStr string) *Shell {
|
||||
cmd := secureexec.Command("sh", "-c", cmdStr)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Dir = s.dir
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("error running shell command: %s\n%s", cmdStr, string(output)))
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Shell) RunShellCommandExpectError(cmdStr string) *Shell {
|
||||
cmd := secureexec.Command("sh", "-c", cmdStr)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Dir = s.dir
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err == nil {
|
||||
panic(fmt.Sprintf("Expected error running shell command: %s\n%s", cmdStr, string(output)))
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Shell) CreateFile(path string, content string) *Shell {
|
||||
fullPath := filepath.Join(s.dir, path)
|
||||
err := os.WriteFile(fullPath, []byte(content), 0o644)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue