@cryptotaxi247 / kubo / commits / b022ba4a3

commands: Fixed tests

Matt Bell committed Oct 20, 2014 at 14:39 UTC b022ba4a3ae3834ebfaccf2404ee66a3597357a8
2 files changed +10 -10
commands/command_test.go
+9 -9
@@ -13,7 +13,7 @@ func TestOptionValidation(t *testing.T) {
13
14 req := NewEmptyRequest()
15 req.SetOption("foo", 5)
16 - res := cmd.Call(req)
16 + res := cmd.Call(req, nil)
17 if res.Error() == nil {
18 t.Error("Should have failed (unrecognized option)")
19 }
@@ -21,21 +21,21 @@ func TestOptionValidation(t *testing.T) {
21 req = NewEmptyRequest()
22 req.SetOption("beep", 5)
23 req.SetOption("b", 10)
24 - res = cmd.Call(req)
24 + res = cmd.Call(req, nil)
25 if res.Error() == nil {
26 t.Error("Should have failed (duplicate options)")
27 }
28
29 req = NewEmptyRequest()
30 req.SetOption("beep", "foo")
31 - res = cmd.Call(req)
31 + res = cmd.Call(req, nil)
32 if res.Error() == nil {
33 t.Error("Should have failed (incorrect type)")
34 }
35
36 req = NewEmptyRequest()
37 req.SetOption("beep", 5)
38 - res = cmd.Call(req)
38 + res = cmd.Call(req, nil)
39 if res.Error() != nil {
40 t.Error(res.Error(), "Should have passed")
41 }
@@ -43,7 +43,7 @@ func TestOptionValidation(t *testing.T) {
43 req = NewEmptyRequest()
44 req.SetOption("beep", 5)
45 req.SetOption("boop", "test")
46 - res = cmd.Call(req)
46 + res = cmd.Call(req, nil)
47 if res.Error() != nil {
48 t.Error("Should have passed")
49 }
@@ -51,28 +51,28 @@ func TestOptionValidation(t *testing.T) {
51 req = NewEmptyRequest()
52 req.SetOption("b", 5)
53 req.SetOption("B", "test")
54 - res = cmd.Call(req)
54 + res = cmd.Call(req, nil)
55 if res.Error() != nil {
56 t.Error("Should have passed")
57 }
58
59 req = NewEmptyRequest()
60 req.SetOption(EncShort, "json")
61 - res = cmd.Call(req)
61 + res = cmd.Call(req, nil)
62 if res.Error() != nil {
63 t.Error("Should have passed")
64 }
65
66 req = NewEmptyRequest()
67 req.SetOption("b", "100")
68 - res = cmd.Call(req)
68 + res = cmd.Call(req, nil)
69 if res.Error() != nil {
70 t.Error("Should have passed")
71 }
72
73 req = NewEmptyRequest()
74 req.SetOption("b", ":)")
75 - res = cmd.Call(req)
75 + res = cmd.Call(req, nil)
76 if res.Error == nil {
77 t.Error(res.Error, "Should have failed (string value not convertible to int)")
78 }
commands/response_test.go
+1 -1
@@ -13,7 +13,7 @@ type TestOutput struct {
13 func TestMarshalling(t *testing.T) {
14 req := NewEmptyRequest()
15
16 - res := NewResponse(req)
16 + res := NewResponse(req, nil)
17 res.SetValue(TestOutput{"beep", "boop", 1337})
18
19 // get command global options so we can set the encoding option