mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-11-26 09:00:57 +02:00
add test for StashSave and refactor StashSave method
This commit is contained in:
parent
99840d8fc4
commit
45fa257128
@ -112,7 +112,7 @@ func (c *GitCommand) StashDo(index int, method string) error {
|
|||||||
// StashSave save stash
|
// StashSave save stash
|
||||||
// TODO: before calling this, check if there is anything to save
|
// TODO: before calling this, check if there is anything to save
|
||||||
func (c *GitCommand) StashSave(message string) error {
|
func (c *GitCommand) StashSave(message string) error {
|
||||||
return c.OSCommand.RunCommand("git stash save " + c.OSCommand.Quote(message))
|
return c.OSCommand.RunCommand(fmt.Sprintf("git stash save %s", c.OSCommand.Quote(message)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeStatusFiles merge status files
|
// MergeStatusFiles merge status files
|
||||||
|
@ -173,6 +173,18 @@ func TestGitCommandStashDo(t *testing.T) {
|
|||||||
assert.NoError(t, gitCmd.StashDo(1, "drop"))
|
assert.NoError(t, gitCmd.StashDo(1, "drop"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGitCommandStashSave(t *testing.T) {
|
||||||
|
gitCmd := newDummyGitCommand()
|
||||||
|
gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd {
|
||||||
|
assert.EqualValues(t, "git", cmd)
|
||||||
|
assert.EqualValues(t, []string{"stash", "save", "A stash message"}, args)
|
||||||
|
|
||||||
|
return exec.Command("echo")
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.NoError(t, gitCmd.StashSave("A stash message"))
|
||||||
|
}
|
||||||
|
|
||||||
func TestGitCommandDiff(t *testing.T) {
|
func TestGitCommandDiff(t *testing.T) {
|
||||||
gitCommand := newDummyGitCommand()
|
gitCommand := newDummyGitCommand()
|
||||||
assert.NoError(t, test.GenerateRepo("lots_of_diffs.sh"))
|
assert.NoError(t, test.GenerateRepo("lots_of_diffs.sh"))
|
||||||
|
Loading…
Reference in New Issue
Block a user