commands/cli: Fixed tests for refactor
Matt Bell committed
Oct 14, 2014 at 15:00 UTC
08885c0ced2c2974dc500a3d763fab5eede0bb1f
1 file changed
+6
-4
commands/cli/parse_test.go
+6
-4
@@ -8,7 +8,11 @@ import (
8
)
9
10
func TestOptionParsing(t *testing.T) {
11
- opts, input, err := parseOptions([]string{ "test", "--beep", "--boop=\"5", "lol\"", "test2", "-cV" }, nil)
11
+ cmd := &commands.Command{}
12
+ cmd.Register("test", &commands.Command{})
13
+
14
+ opts, input, err := parseOptions([]string{ "--beep", "--boop=\"5", "lol\"", "test2", "-cV" },
15
+ []string{"test"}, cmd)
16
/*for k, v := range opts {
17
fmt.Printf("%s: %s\n", k, v)
18
}
@@ -19,12 +23,10 @@ func TestOptionParsing(t *testing.T) {
23
if len(opts) != 4 || opts["c"] != "" || opts["V"] != "" || opts["beep"] != "" || opts["boop"] != "5 lol" {
24
t.Error("Returned options were defferent than expected: %v", opts)
25
}
22
- if len(input) != 2 || input[0] != "test" || input[1] != "test2" {
26
+ if len(input) != 1 || input[0] != "test2" {
27
t.Error("Returned input was different than expected: %v", input)
28
}
29
26
- cmd := &commands.Command{}
27
- cmd.Register("test", &commands.Command{})
30
path, args, err := parsePath([]string{ "test", "beep", "boop" }, cmd)
31
if err != nil {
32
t.Error("Should have passed")