hub/cmd/cmd_test.go

21 строка
432 B
Go

package cmd
import (
"testing"
"github.com/bmizerany/assert"
)
func TestNew(t *testing.T) {
execCmd := New("vim --noplugin")
assert.Equal(t, "vim --noplugin", execCmd.Name)
assert.Equal(t, 0, len(execCmd.Args))
}
func TestWithArg(t *testing.T) {
execCmd := New("git")
execCmd.WithArg("command").WithArg("--amend").WithArg("-m").WithArg(`""`)
assert.Equal(t, "git", execCmd.Name)
assert.Equal(t, 4, len(execCmd.Args))
}