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