From 13f90735522d55d83c724aa949dcef3061da290e Mon Sep 17 00:00:00 2001 From: Anthony HAMON Date: Mon, 27 Aug 2018 23:20:27 +0200 Subject: [PATCH] add test for GetStashEntryDiff --- pkg/commands/git_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index e709e747a..d8df7b4b0 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -70,6 +70,20 @@ func TestGitCommandGetStashEntries(t *testing.T) { } } +func TestGetStashEntryDiff(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", "show", "-p", "--color", "stash@{1}"}, args) + + return exec.Command("echo") + } + + _, err := gitCmd.GetStashEntryDiff(1) + + assert.NoError(t, err) +} + func TestGitCommandDiff(t *testing.T) { gitCommand := newDummyGitCommand() assert.NoError(t, test.GenerateRepo("lots_of_diffs.sh"))