summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:47:54 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-28 11:59:45 +1100
commit814ee24c8d13ae554925530ec68f325394ddfe6d (patch)
treed4713ad9927e84ad043b640165d132fcc6113dca /pkg/commands
parent7876cddf4a8390e9d22631e9be036c75b05f418c (diff)
better error handling
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_test.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go
index 8d9bdef40..56e2923cd 100644
--- a/pkg/commands/git_test.go
+++ b/pkg/commands/git_test.go
@@ -1097,75 +1097,6 @@ func TestGitCommandUnstageFile(t *testing.T) {
}
}
-// TestGitCommandIsInMergeState is a function.
-func TestGitCommandIsInMergeState(t *testing.T) {
- type scenario struct {
- testName string
- command func(string, ...string) *exec.Cmd
- test func(bool, error)
- }
-
- scenarios := []scenario{
- {
- "An error occurred when running status command",
- func(cmd string, args ...string) *exec.Cmd {
- assert.EqualValues(t, "git", cmd)
- assert.EqualValues(t, []string{"status", "--untracked-files=all"}, args)
-
- return exec.Command("test")
- },
- func(isInMergeState bool, err error) {
- assert.Error(t, err)
- assert.False(t, isInMergeState)
- },
- },
- {
- "Is not in merge state",
- func(cmd string, args ...string) *exec.Cmd {
- assert.EqualValues(t, "git", cmd)
- assert.EqualValues(t, []string{"status", "--untracked-files=all"}, args)
- return exec.Command("echo")
- },
- func(isInMergeState bool, err error) {
- assert.False(t, isInMergeState)
- assert.NoError(t, err)
- },
- },
- {
- "Command output contains conclude merge",
- func(cmd string, args ...string) *exec.Cmd {
- assert.EqualValues(t, "git", cmd)
- assert.EqualValues(t, []string{"status", "--untracked-files=all"}, args)
- return exec.Command("echo", "'conclude merge'")
- },
- func(isInMergeState bool, err error) {
- assert.True(t, isInMergeState)
- assert.NoError(t, err)
- },
- },
- {
- "Command output contains unmerged paths",
- func(cmd string, args ...string) *exec.Cmd {
- assert.EqualValues(t, "git", cmd)
- assert.EqualValues(t, []string{"status", "--untracked-files=all"}, args)
- return exec.Command("echo", "'unmerged paths'")
- },
- func(isInMergeState bool, err error) {
- assert.True(t, isInMergeState)
- assert.NoError(t, err)
- },
- },
- }
-
- for _, s := range scenarios {
- t.Run(s.testName, func(t *testing.T) {
- gitCmd := NewDummyGitCommand()
- gitCmd.OSCommand.command = s.command
- s.test(gitCmd.IsInMergeState())
- })
- }
-}
-
// TestGitCommandDiscardAllFileChanges is a function.
func TestGitCommandDiscardAllFileChanges(t *testing.T) {
type scenario struct {