From f9c7ed72b80fdda4bd5c4fce08da4853b2b46972 Mon Sep 17 00:00:00 2001 From: Theodore Kokkoris Date: Fri, 12 Jul 2013 13:31:53 +0300 Subject: [PATCH] Added tests for gh push --- commands/push_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 commands/push_test.go diff --git a/commands/push_test.go b/commands/push_test.go new file mode 100644 index 00000000..12f9b100 --- /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, "") +} -- GitLab