Add test for opening lazygit in the worktree of a bare repo

This commit is contained in:
Jesse Duffield 2023-07-27 21:52:24 +10:00
parent e874f94cf8
commit 2b24c15938
5 changed files with 109 additions and 28 deletions

View file

@ -85,7 +85,7 @@ func (self *Shell) CreateFile(path string, content string) *Shell {
func (self *Shell) DeleteFile(path string) *Shell {
fullPath := filepath.Join(self.dir, path)
err := os.Remove(fullPath)
err := os.RemoveAll(fullPath)
if err != nil {
self.fail(fmt.Sprintf("error deleting file: %s\n%s", fullPath, err))
}
@ -328,3 +328,11 @@ func (self *Shell) CopyFile(source string, destination string) *Shell {
return self
}
// NOTE: this only takes effect before running the test;
// the test will still run in the original directory
func (self *Shell) Chdir(path string) *Shell {
self.dir = filepath.Join(self.dir, path)
return self
}