diff --git a/commands/push_test.go b/commands/push_test.go new file mode 100644 index 0000000000000000000000000000000000000000..12f9b100df503bbf06144207930f78fd9f417f23 --- /dev/null +++ b/commands/push_test.go @@ -0,0 +1,28 @@ +package commands + +import ( + "github.com/bmizerany/assert" + "testing" +) + +func TestGetRemotesRef(t *testing.T) { + args := NewArgs([]string{"push", "origin", "master"}) + remotes, ref := getRemotesRef(args) + assert.Equal(t, remotes, []string{"origin"}) + assert.Equal(t, ref, "master") + + args = NewArgs([]string{"push", "origin"}) + remotes, ref = getRemotesRef(args) + assert.Equal(t, remotes, []string{"origin"}) + assert.Equal(t, ref, "") + + args = NewArgs([]string{"push", "origin,experimental", "master"}) + remotes, ref = getRemotesRef(args) + assert.Equal(t, remotes, []string{"origin", "experimental"}) + assert.Equal(t, ref, "master") + + args = NewArgs([]string{"push", "origin,experimental"}) + remotes, ref = getRemotesRef(args) + assert.Equal(t, remotes, []string{"origin", "experimental"}) + assert.Equal(t, ref, "") +}