1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-10 11:10:18 +02:00

move shell into test driver

This commit is contained in:
Jesse Duffield 2022-12-27 21:47:37 +11:00
parent 78b495f50a
commit c5050ecabd
39 changed files with 108 additions and 131 deletions

View File

@ -126,7 +126,7 @@ func buildLazygit() error {
}
func createFixture(test *IntegrationTest, paths Paths) error {
shell := NewShell(paths.ActualRepo())
shell := NewShell(paths.ActualRepo(), func(errorMsg string) { panic(errorMsg) })
shell.RunCommand("git init -b master")
shell.RunCommand(`git config user.email "CI@example.com"`)
shell.RunCommand(`git config user.name "CI"`)

View File

@ -15,119 +15,122 @@ import (
type Shell struct {
// working directory the shell is invoked in
dir string
// when running the shell outside the gui we can directly panic on failure,
// but inside the gui we need to close the gui before panicking
fail func(string)
}
func NewShell(dir string) *Shell {
return &Shell{dir: dir}
func NewShell(dir string, fail func(string)) *Shell {
return &Shell{dir: dir, fail: fail}
}
func (s *Shell) RunCommand(cmdStr string) *Shell {
func (self *Shell) RunCommand(cmdStr string) *Shell {
args := str.ToArgv(cmdStr)
cmd := secureexec.Command(args[0], args[1:]...)
cmd.Env = os.Environ()
cmd.Dir = s.dir
cmd.Dir = self.dir
output, err := cmd.CombinedOutput()
if err != nil {
panic(fmt.Sprintf("error running command: %s\n%s", cmdStr, string(output)))
self.fail(fmt.Sprintf("error running command: %s\n%s", cmdStr, string(output)))
}
return s
return self
}
func (s *Shell) RunShellCommand(cmdStr string) *Shell {
func (self *Shell) RunShellCommand(cmdStr string) *Shell {
cmd := secureexec.Command("sh", "-c", cmdStr)
cmd.Env = os.Environ()
cmd.Dir = s.dir
cmd.Dir = self.dir
output, err := cmd.CombinedOutput()
if err != nil {
panic(fmt.Sprintf("error running shell command: %s\n%s", cmdStr, string(output)))
self.fail(fmt.Sprintf("error running shell command: %s\n%s", cmdStr, string(output)))
}
return s
return self
}
func (s *Shell) RunShellCommandExpectError(cmdStr string) *Shell {
func (self *Shell) RunShellCommandExpectError(cmdStr string) *Shell {
cmd := secureexec.Command("sh", "-c", cmdStr)
cmd.Env = os.Environ()
cmd.Dir = s.dir
cmd.Dir = self.dir
output, err := cmd.CombinedOutput()
if err == nil {
panic(fmt.Sprintf("Expected error running shell command: %s\n%s", cmdStr, string(output)))
self.fail(fmt.Sprintf("Expected error running shell command: %s\n%s", cmdStr, string(output)))
}
return s
return self
}
func (s *Shell) CreateFile(path string, content string) *Shell {
fullPath := filepath.Join(s.dir, path)
func (self *Shell) CreateFile(path string, content string) *Shell {
fullPath := filepath.Join(self.dir, path)
err := os.WriteFile(fullPath, []byte(content), 0o644)
if err != nil {
panic(fmt.Sprintf("error creating file: %s\n%s", fullPath, err))
self.fail(fmt.Sprintf("error creating file: %s\n%s", fullPath, err))
}
return s
return self
}
func (s *Shell) CreateDir(path string) *Shell {
fullPath := filepath.Join(s.dir, path)
func (self *Shell) CreateDir(path string) *Shell {
fullPath := filepath.Join(self.dir, path)
if err := os.MkdirAll(fullPath, 0o755); err != nil {
panic(fmt.Sprintf("error creating directory: %s\n%s", fullPath, err))
self.fail(fmt.Sprintf("error creating directory: %s\n%s", fullPath, err))
}
return s
return self
}
func (s *Shell) UpdateFile(path string, content string) *Shell {
fullPath := filepath.Join(s.dir, path)
func (self *Shell) UpdateFile(path string, content string) *Shell {
fullPath := filepath.Join(self.dir, path)
err := os.WriteFile(fullPath, []byte(content), 0o644)
if err != nil {
panic(fmt.Sprintf("error updating file: %s\n%s", fullPath, err))
self.fail(fmt.Sprintf("error updating file: %s\n%s", fullPath, err))
}
return s
return self
}
func (s *Shell) NewBranch(name string) *Shell {
return s.RunCommand("git checkout -b " + name)
func (self *Shell) NewBranch(name string) *Shell {
return self.RunCommand("git checkout -b " + name)
}
func (s *Shell) Checkout(name string) *Shell {
return s.RunCommand("git checkout " + name)
func (self *Shell) Checkout(name string) *Shell {
return self.RunCommand("git checkout " + name)
}
func (s *Shell) Merge(name string) *Shell {
return s.RunCommand("git merge --commit --no-ff " + name)
func (self *Shell) Merge(name string) *Shell {
return self.RunCommand("git merge --commit --no-ff " + name)
}
func (s *Shell) GitAdd(path string) *Shell {
return s.RunCommand(fmt.Sprintf("git add \"%s\"", path))
func (self *Shell) GitAdd(path string) *Shell {
return self.RunCommand(fmt.Sprintf("git add \"%s\"", path))
}
func (s *Shell) GitAddAll() *Shell {
return s.RunCommand("git add -A")
func (self *Shell) GitAddAll() *Shell {
return self.RunCommand("git add -A")
}
func (s *Shell) Commit(message string) *Shell {
return s.RunCommand(fmt.Sprintf("git commit -m \"%s\"", message))
func (self *Shell) Commit(message string) *Shell {
return self.RunCommand(fmt.Sprintf("git commit -m \"%s\"", message))
}
func (s *Shell) EmptyCommit(message string) *Shell {
return s.RunCommand(fmt.Sprintf("git commit --allow-empty -m \"%s\"", message))
func (self *Shell) EmptyCommit(message string) *Shell {
return self.RunCommand(fmt.Sprintf("git commit --allow-empty -m \"%s\"", message))
}
// convenience method for creating a file and adding it
func (s *Shell) CreateFileAndAdd(fileName string, fileContents string) *Shell {
return s.
func (self *Shell) CreateFileAndAdd(fileName string, fileContents string) *Shell {
return self.
CreateFile(fileName, fileContents).
GitAdd(fileName)
}
// convenience method for updating a file and adding it
func (s *Shell) UpdateFileAndAdd(fileName string, fileContents string) *Shell {
return s.
func (self *Shell) UpdateFileAndAdd(fileName string, fileContents string) *Shell {
return self.
UpdateFile(fileName, fileContents).
GitAdd(fileName)
}
@ -135,24 +138,24 @@ func (s *Shell) UpdateFileAndAdd(fileName string, fileContents string) *Shell {
// creates commits 01, 02, 03, ..., n with a new file in each
// The reason for padding with zeroes is so that it's easier to do string
// matches on the commit messages when there are many of them
func (s *Shell) CreateNCommits(n int) *Shell {
func (self *Shell) CreateNCommits(n int) *Shell {
for i := 1; i <= n; i++ {
s.CreateFileAndAdd(
self.CreateFileAndAdd(
fmt.Sprintf("file%02d.txt", i),
fmt.Sprintf("file%02d content", i),
).
Commit(fmt.Sprintf("commit %02d", i))
}
return s
return self
}
func (s *Shell) StashWithMessage(message string) *Shell {
s.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
return s
func (self *Shell) StashWithMessage(message string) *Shell {
self.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
return self
}
func (s *Shell) SetConfig(key string, value string) *Shell {
s.RunCommand(fmt.Sprintf(`git config --local "%s" %s`, key, value))
return s
func (self *Shell) SetConfig(key string, value string) *Shell {
self.RunCommand(fmt.Sprintf(`git config --local "%s" %s`, key, value))
return self
}

View File

@ -24,8 +24,7 @@ type IntegrationTest struct {
setupRepo func(shell *Shell)
setupConfig func(config *config.AppConfig)
run func(
shell *Shell,
testController *TestDriver,
testDriver *TestDriver,
keys config.KeybindingConfig,
)
}
@ -40,7 +39,7 @@ type NewIntegrationTestArgs struct {
// takes a config and mutates. The mutated context will end up being passed to the gui
SetupConfig func(config *config.AppConfig)
// runs the test
Run func(shell *Shell, t *TestDriver, keys config.KeybindingConfig)
Run func(t *TestDriver, keys config.KeybindingConfig)
// additional args passed to lazygit
ExtraCmdArgs string
// for when a test is flakey
@ -92,15 +91,15 @@ func (self *IntegrationTest) SetupRepo(shell *Shell) {
// I want access to all contexts, the model, the ability to press a key, the ability to log,
func (self *IntegrationTest) Run(gui integrationTypes.GuiDriver) {
shell := NewShell("/tmp/lazygit-test")
shell := NewShell("/tmp/lazygit-test", func(errorMsg string) { gui.Fail(errorMsg) })
keys := gui.Keys()
testController := NewTestController(gui, keys, KeyPressDelay())
testDriver := NewTestDriver(gui, shell, keys, KeyPressDelay())
self.run(shell, testController, keys)
self.run(testDriver, keys)
if KeyPressDelay() > 0 {
// the dev would want to see the final state if they're running in slow mode
testController.Wait(2000)
testDriver.Wait(2000)
}
}

View File

@ -16,14 +16,16 @@ type TestDriver struct {
keys config.KeybindingConfig
pushKeyDelay int
*assertionHelper
shell *Shell
}
func NewTestController(gui integrationTypes.GuiDriver, keys config.KeybindingConfig, pushKeyDelay int) *TestDriver {
func NewTestDriver(gui integrationTypes.GuiDriver, shell *Shell, keys config.KeybindingConfig, pushKeyDelay int) *TestDriver {
return &TestDriver{
gui: gui,
keys: keys,
pushKeyDelay: pushKeyDelay,
assertionHelper: &assertionHelper{gui: gui},
shell: shell,
}
}
@ -67,6 +69,11 @@ func (self *TestDriver) Log(message string) {
self.gui.LogUI(message)
}
// allows the user to run shell commands during the test to emulate background activity
func (self *TestDriver) Shell() *Shell {
return self.shell
}
// this will look for a list item in the current panel and if it finds it, it will
// enter the keypresses required to navigate to it.
// The test will fail if:

View File

@ -63,7 +63,7 @@ func (self *fakeGuiDriver) View(viewName string) *gocui.View {
func TestAssertionFailure(t *testing.T) {
test := NewIntegrationTest(NewIntegrationTestArgs{
Description: unitTestDescription,
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.press("a")
t.press("b")
t.Model().CommitCount(2)
@ -78,7 +78,7 @@ func TestAssertionFailure(t *testing.T) {
func TestManualFailure(t *testing.T) {
test := NewIntegrationTest(NewIntegrationTestArgs{
Description: unitTestDescription,
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Fail("blah")
},
})
@ -90,7 +90,7 @@ func TestManualFailure(t *testing.T) {
func TestSuccess(t *testing.T) {
test := NewIntegrationTest(NewIntegrationTestArgs{
Description: unitTestDescription,
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.press("a")
t.press("b")
t.Model().CommitCount(0)

View File

@ -14,11 +14,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
CreateNCommits(10)
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
markCommitAsBad := func() {
t.Views().Commits().
Press(keys.Commits.ViewBisectOptions)

View File

@ -18,11 +18,7 @@ var FromOtherBranch = NewIntegrationTest(NewIntegrationTestArgs{
RunCommand("git bisect start other~2 other~5")
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Information().Content(Contains("bisecting"))
t.Model().AtLeastOneCommit()

View File

@ -17,7 +17,7 @@ var CheckoutByName = NewIntegrationTest(NewIntegrationTestArgs{
Checkout("master").
EmptyCommit("blah")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(

View File

@ -16,7 +16,7 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
NewBranch("branch-one").
NewBranch("branch-two")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(

View File

@ -14,7 +14,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
SetupRepo: func(shell *Shell) {
shared.MergeConflictsSetup(shell)
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().TopLines(
Contains("first change"),
Contains("original"),

View File

@ -17,7 +17,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
shell.EmptyCommit("to remove")
shell.EmptyCommit("to keep")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(

View File

@ -20,7 +20,7 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{
shell.Checkout("current-branch")
shell.EmptyCommit("current-branch commit")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Lines(
Contains("current-branch commit"),
Contains("root commit"),

View File

@ -20,7 +20,7 @@ var Suggestions = NewIntegrationTest(NewIntegrationTestArgs{
NewBranch("other-new-branch-2").
NewBranch("other-new-branch-3")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Press(keys.Branches.CheckoutBranchByName)

View File

@ -23,7 +23,7 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
EmptyCommit("four").
Checkout("first-branch")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(

View File

@ -14,7 +14,7 @@ var CherryPickConflicts = NewIntegrationTest(NewIntegrationTestArgs{
SetupRepo: func(shell *Shell) {
shared.MergeConflictsSetup(shell)
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(

View File

@ -14,7 +14,7 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
shell.CreateFile("myfile", "myfile content")
shell.CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(0)
t.Views().Files().

View File

@ -13,7 +13,7 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
SetupRepo: func(shell *Shell) {
shell.CreateFile("myfile", "myfile content")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(0)
t.Views().Files().

View File

@ -16,7 +16,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
EmptyCommit("commit 2").
EmptyCommit("commit 3")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(3)
t.Views().Commits().

View File

@ -15,7 +15,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
shell.GitAddAll()
shell.Commit("first commit")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(1)
t.Views().Commits().

View File

@ -15,7 +15,7 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(0)
t.Views().Files().

View File

@ -15,7 +15,7 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(0)
// stage the file

View File

@ -17,7 +17,7 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
CreateFile("myfile", "myfile content\nwith a second line").
CreateFile("myfile2", "myfile2 content")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(0)
t.Views().Files().

View File

@ -15,11 +15,7 @@ var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{
CreateNCommits(2)
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
// here we're just asserting that we haven't panicked upon starting lazygit
t.Model().AtLeastOneCommit()
},

View File

@ -21,11 +21,7 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
},
}
},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().WorkingTreeFileCount(0)
t.Views().Files().

View File

@ -55,11 +55,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
},
}
},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().WorkingTreeFileCount(0)
t.Views().Files().

View File

@ -42,11 +42,7 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
},
}
},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().WorkingTreeFileCount(0)
t.Views().Branches().
Focus().

View File

@ -41,11 +41,7 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{
},
}
},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CurrentBranchName("feature/bar")
t.Model().WorkingTreeFileCount(0)

View File

@ -53,11 +53,7 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{
},
}
},
Run: func(
shell *Shell,
t *TestDriver,
keys config.KeybindingConfig,
) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().WorkingTreeFileCount(0)
t.Views().Files().

View File

@ -21,7 +21,7 @@ var Diff = NewIntegrationTest(NewIntegrationTestArgs{
shell.Checkout("branch-a")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
TopLines(

View File

@ -21,7 +21,7 @@ var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{
shell.Checkout("branch-a")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Lines(

View File

@ -18,7 +18,7 @@ var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{
shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n")
shell.Commit("third commit")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(

View File

@ -21,7 +21,7 @@ var DirWithUntrackedFile = NewIntegrationTest(NewIntegrationTestArgs{
shell.CreateFile("dir/untracked", "bar")
shell.UpdateFile("dir/file", "baz")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(1)
t.Views().Main().

View File

@ -71,7 +71,7 @@ var DiscardChanges = NewIntegrationTest(NewIntegrationTestArgs{
shell.RunShellCommand(`echo "renamed\nhaha" > renamed2.txt && git add renamed2.txt`)
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(3)
type statusFile struct {

View File

@ -27,7 +27,7 @@ var AmendMerge = NewIntegrationTest(NewIntegrationTestArgs{
Merge("feature-branch").
CreateFileAndAdd(postMergeFilename, postMergeFileContent)
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(3)
mergeCommitMessage := "Merge branch 'feature-branch' into development-branch"

View File

@ -14,7 +14,7 @@ var One = NewIntegrationTest(NewIntegrationTestArgs{
shell.
CreateNCommits(5) // these will appears at commit 05, 04, 04, down to 01
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().
Focus().
Lines(

View File

@ -13,7 +13,7 @@ var ConfirmOnQuit = NewIntegrationTest(NewIntegrationTestArgs{
config.UserConfig.ConfirmOnQuit = true
},
SetupRepo: func(shell *Shell) {},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().CommitCount(0)
t.Views().Files().

View File

@ -18,7 +18,7 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{
CreateFileAndAdd("file-2", "change to stash2").
StashWithMessage("bar")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Stash().
Focus().
Lines(

View File

@ -15,7 +15,7 @@ var Stash = NewIntegrationTest(NewIntegrationTestArgs{
shell.CreateFile("file", "content")
shell.GitAddAll()
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().StashCount(0)
t.Model().WorkingTreeFileCount(1)

View File

@ -16,7 +16,7 @@ var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{
shell.CreateFile("file_2", "content")
shell.GitAdd("file_1")
},
Run: func(shell *Shell, t *TestDriver, keys config.KeybindingConfig) {
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Model().StashCount(0)
t.Model().WorkingTreeFileCount(2)