hub/commands/fetch_test.go

28 строки
716 B
Go
Исходник Обычный вид История

2013-07-11 03:29:26 +04:00
package commands
import (
"github.com/bmizerany/assert"
2013-07-11 03:29:26 +04:00
"testing"
)
func TestParseRemoteNames(t *testing.T) {
args := NewArgs([]string{"fetch", "jingweno,foo"})
names := parseRemoteNames(args)
assert.Equal(t, 2, len(names))
assert.Equal(t, "jingweno", names[0])
assert.Equal(t, "foo", names[1])
cmd := args.ToCmd()
assert.Equal(t, "git fetch --multiple jingweno foo", cmd.String())
args = NewArgs([]string{"fetch", "--multiple", "jingweno", "foo"})
names = parseRemoteNames(args)
assert.Equal(t, 2, len(names))
assert.Equal(t, "jingweno", names[0])
assert.Equal(t, "foo", names[1])
args = NewArgs([]string{"fetch", "--multiple"})
names = parseRemoteNames(args)
assert.Equal(t, 0, len(names))
}