hub/commands/submodule_test.go

34 строки
1.0 KiB
Go
Исходник Обычный вид История

2013-07-13 12:19:42 +04:00
package commands
import (
"github.com/bmizerany/assert"
"github.com/jingweno/gh/github"
"testing"
)
func TestTransformSubmoduleArgs(t *testing.T) {
2013-12-17 19:07:26 +04:00
github.CreateTestConfigs("jingweno", "123")
2013-07-13 12:19:42 +04:00
args := NewArgs([]string{"submodule", "add", "jingweno/gh", "vendor/gh"})
2013-07-13 12:19:42 +04:00
transformSubmoduleArgs(args)
cmds := args.Commands()
assert.Equal(t, 1, len(cmds))
assert.Equal(t, "git submodule add git://github.com/jingweno/gh.git vendor/gh", cmds[0].String())
2013-07-13 12:19:42 +04:00
args = NewArgs([]string{"submodule", "add", "-p", "jingweno/gh",
"vendor/gh"})
2013-07-13 12:19:42 +04:00
transformSubmoduleArgs(args)
cmds = args.Commands()
assert.Equal(t, 1, len(cmds))
assert.Equal(t, "git submodule add git@github.com:jingweno/gh.git vendor/gh", cmds[0].String())
2013-07-13 12:19:42 +04:00
args = NewArgs([]string{"submodule", "add", "-b", "gh", "--name", "gh", "jingweno/gh", "vendor/gh"})
2013-07-13 12:19:42 +04:00
transformSubmoduleArgs(args)
cmds = args.Commands()
assert.Equal(t, 1, len(cmds))
assert.Equal(t, "git submodule add -b gh --name gh git://github.com/jingweno/gh.git vendor/gh", cmds[0].String())
2013-07-13 12:19:42 +04:00
}