Commit b022ba4a authored by Matt Bell's avatar Matt Bell

commands: Fixed tests

parent 7bd7ed6d
...@@ -13,7 +13,7 @@ func TestOptionValidation(t *testing.T) { ...@@ -13,7 +13,7 @@ func TestOptionValidation(t *testing.T) {
req := NewEmptyRequest() req := NewEmptyRequest()
req.SetOption("foo", 5) req.SetOption("foo", 5)
res := cmd.Call(req) res := cmd.Call(req, nil)
if res.Error() == nil { if res.Error() == nil {
t.Error("Should have failed (unrecognized option)") t.Error("Should have failed (unrecognized option)")
} }
...@@ -21,21 +21,21 @@ func TestOptionValidation(t *testing.T) { ...@@ -21,21 +21,21 @@ func TestOptionValidation(t *testing.T) {
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("beep", 5) req.SetOption("beep", 5)
req.SetOption("b", 10) req.SetOption("b", 10)
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() == nil { if res.Error() == nil {
t.Error("Should have failed (duplicate options)") t.Error("Should have failed (duplicate options)")
} }
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("beep", "foo") req.SetOption("beep", "foo")
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() == nil { if res.Error() == nil {
t.Error("Should have failed (incorrect type)") t.Error("Should have failed (incorrect type)")
} }
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("beep", 5) req.SetOption("beep", 5)
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() != nil { if res.Error() != nil {
t.Error(res.Error(), "Should have passed") t.Error(res.Error(), "Should have passed")
} }
...@@ -43,7 +43,7 @@ func TestOptionValidation(t *testing.T) { ...@@ -43,7 +43,7 @@ func TestOptionValidation(t *testing.T) {
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("beep", 5) req.SetOption("beep", 5)
req.SetOption("boop", "test") req.SetOption("boop", "test")
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() != nil { if res.Error() != nil {
t.Error("Should have passed") t.Error("Should have passed")
} }
...@@ -51,28 +51,28 @@ func TestOptionValidation(t *testing.T) { ...@@ -51,28 +51,28 @@ func TestOptionValidation(t *testing.T) {
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("b", 5) req.SetOption("b", 5)
req.SetOption("B", "test") req.SetOption("B", "test")
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() != nil { if res.Error() != nil {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption(EncShort, "json") req.SetOption(EncShort, "json")
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() != nil { if res.Error() != nil {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("b", "100") req.SetOption("b", "100")
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error() != nil { if res.Error() != nil {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewEmptyRequest() req = NewEmptyRequest()
req.SetOption("b", ":)") req.SetOption("b", ":)")
res = cmd.Call(req) res = cmd.Call(req, nil)
if res.Error == nil { if res.Error == nil {
t.Error(res.Error, "Should have failed (string value not convertible to int)") t.Error(res.Error, "Should have failed (string value not convertible to int)")
} }
......
...@@ -13,7 +13,7 @@ type TestOutput struct { ...@@ -13,7 +13,7 @@ type TestOutput struct {
func TestMarshalling(t *testing.T) { func TestMarshalling(t *testing.T) {
req := NewEmptyRequest() req := NewEmptyRequest()
res := NewResponse(req) res := NewResponse(req, nil)
res.SetValue(TestOutput{"beep", "boop", 1337}) res.SetValue(TestOutput{"beep", "boop", 1337})
// get command global options so we can set the encoding option // get command global options so we can set the encoding option
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment