commands: Fixed tests
Matt Bell committed
Nov 19, 2014 at 00:36 UTC
ae6f00d76660c48b3efabe4a1321fc7f740b9122
2 files changed
+6
-6
commands/cli/parse_test.go
+1
-1
@@ -11,7 +11,7 @@ func TestOptionParsing(t *testing.T) {
11
subCmd := &commands.Command{}
12
cmd := &commands.Command{
13
Options: []commands.Option{
14
- commands.Option{Names: []string{"b"}, Type: commands.String},
14
+ commands.StringOption("b", "some option"),
15
},
16
Subcommands: map[string]*commands.Command{
17
"test": subCmd,
commands/command_test.go
+5
-5
@@ -9,8 +9,8 @@ func noop(req Request) (interface{}, error) {
9
func TestOptionValidation(t *testing.T) {
10
cmd := Command{
11
Options: []Option{
12
- Option{[]string{"b", "beep"}, Int, "enables beeper"},
13
- Option{[]string{"B", "boop"}, String, "password for booper"},
12
+ IntOption("b", "beep", "enables beeper"),
13
+ StringOption("B", "boop", "password for booper"),
14
},
15
Run: noop,
16
}
@@ -93,14 +93,14 @@ func TestOptionValidation(t *testing.T) {
93
func TestRegistration(t *testing.T) {
94
cmdA := &Command{
95
Options: []Option{
96
- Option{[]string{"beep"}, Int, "number of beeps"},
96
+ IntOption("beep", "number of beeps"),
97
},
98
Run: noop,
99
}
100
101
cmdB := &Command{
102
Options: []Option{
103
- Option{[]string{"beep"}, Int, "number of beeps"},
103
+ IntOption("beep", "number of beeps"),
104
},
105
Run: noop,
106
Subcommands: map[string]*Command{
@@ -110,7 +110,7 @@ func TestRegistration(t *testing.T) {
110
111
cmdC := &Command{
112
Options: []Option{
113
- Option{[]string{"encoding"}, String, "data encoding type"},
113
+ StringOption("encoding", "data encoding type"),
114
},
115
Run: noop,
116
}