diff options
Diffstat (limited to 'pkg/commands/git_test.go')
-rw-r--r-- | pkg/commands/git_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index d5b87a1f1..a2b2b9524 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1763,3 +1763,15 @@ func TestGitCommandGetMergeBase(t *testing.T) { }) } } + +func TestGitCommandCurrentBranchName(t *testing.T) { + gitCmd := newDummyGitCommand() + gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd { + assert.Equal(t, "git", cmd) + assert.EqualValues(t, []string{"symbolic-ref", "--short", "HEAD"}, args) + return exec.Command("echo", "master") + } + output, err := gitCmd.CurrentBranchName() + assert.Equal(t, "master", output) + assert.NoError(t, err) +} |