2013-07-12 14:31:53 +04:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2020-04-17 02:02:37 +03:00
|
|
|
"github.com/github/hub/v2/internal/assert"
|
2013-07-12 14:31:53 +04:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2013-08-17 02:35:46 +04:00
|
|
|
func TestTransformPushArgs(t *testing.T) {
|
2013-07-20 00:52:14 +04:00
|
|
|
args := NewArgs([]string{"push", "origin,staging,qa", "bert_timeout"})
|
|
|
|
transformPushArgs(args)
|
|
|
|
cmds := args.Commands()
|
2013-07-12 14:31:53 +04:00
|
|
|
|
2013-07-20 00:52:14 +04:00
|
|
|
assert.Equal(t, 3, len(cmds))
|
|
|
|
assert.Equal(t, "git push origin bert_timeout", cmds[0].String())
|
|
|
|
assert.Equal(t, "git push staging bert_timeout", cmds[1].String())
|
2013-07-12 14:31:53 +04:00
|
|
|
|
2013-08-17 02:35:46 +04:00
|
|
|
// TODO: travis-ci doesn't have HEAD
|
|
|
|
//args = NewArgs([]string{"push", "origin"})
|
|
|
|
//transformPushArgs(args)
|
|
|
|
//cmds = args.Commands()
|
2013-07-20 00:52:14 +04:00
|
|
|
|
2013-08-17 02:35:46 +04:00
|
|
|
//assert.Equal(t, 1, len(cmds))
|
|
|
|
//pushRegexp := regexp.MustCompile("git push origin .+")
|
|
|
|
//assert.T(t, pushRegexp.MatchString(cmds[0].String()))
|
2013-07-12 14:31:53 +04:00
|
|
|
}
|