@cryptotaxi247 / kubo / commits / 4f10f0366

commands: Fixed tests

Matt Bell committed Oct 21, 2014 at 16:15 UTC 4f10f036600b42fb63805bfe00c5bee5c09d723a
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, nil)
16 + res := cmd.Call(req)
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, nil)
24 + res = cmd.Call(req)
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, nil)
31 + res = cmd.Call(req)
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, nil)
38 + res = cmd.Call(req)
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, nil)
46 + res = cmd.Call(req)
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, nil)
54 + res = cmd.Call(req)
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, nil)
61 + res = cmd.Call(req)
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, nil)
68 + res = cmd.Call(req)
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, nil)
75 + res = cmd.Call(req)
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, nil)
16 + res := NewResponse(req)
17 res.SetValue(TestOutput{"beep", "boop", 1337})
18
19 // get command global options so we can set the encoding option