提交 4b0f44e4 作者: Matt Bell 提交者: Juan Batiz-Benet

commands: Fixed tests

上级 09311d4b
...@@ -11,14 +11,14 @@ func TestOptionValidation(t *testing.T) { ...@@ -11,14 +11,14 @@ func TestOptionValidation(t *testing.T) {
f: func(req *Request, res *Response) {}, f: func(req *Request, res *Response) {},
} }
req := NewRequest() req := NewEmptyRequest()
req.options["foo"] = 5 req.options["foo"] = 5
res := cmd.Call(req) res := cmd.Call(req)
if res.Error == nil { if res.Error == nil {
t.Error("Should have failed (unrecognized option)") t.Error("Should have failed (unrecognized option)")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["beep"] = 5 req.options["beep"] = 5
req.options["b"] = 10 req.options["b"] = 10
res = cmd.Call(req) res = cmd.Call(req)
...@@ -26,21 +26,21 @@ func TestOptionValidation(t *testing.T) { ...@@ -26,21 +26,21 @@ func TestOptionValidation(t *testing.T) {
t.Error("Should have failed (duplicate options)") t.Error("Should have failed (duplicate options)")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["beep"] = "foo" req.options["beep"] = "foo"
res = cmd.Call(req) res = cmd.Call(req)
if res.Error == nil { if res.Error == nil {
t.Error("Should have failed (incorrect type)") t.Error("Should have failed (incorrect type)")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["beep"] = 5 req.options["beep"] = 5
res = cmd.Call(req) res = cmd.Call(req)
if res.Error != nil { if res.Error != nil {
t.Error(res.Error, "Should have passed") t.Error(res.Error, "Should have passed")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["beep"] = 5 req.options["beep"] = 5
req.options["boop"] = "test" req.options["boop"] = "test"
res = cmd.Call(req) res = cmd.Call(req)
...@@ -48,7 +48,7 @@ func TestOptionValidation(t *testing.T) { ...@@ -48,7 +48,7 @@ func TestOptionValidation(t *testing.T) {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["b"] = 5 req.options["b"] = 5
req.options["B"] = "test" req.options["B"] = "test"
res = cmd.Call(req) res = cmd.Call(req)
...@@ -56,21 +56,21 @@ func TestOptionValidation(t *testing.T) { ...@@ -56,21 +56,21 @@ func TestOptionValidation(t *testing.T) {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["enc"] = "json" req.options["enc"] = "json"
res = cmd.Call(req) res = cmd.Call(req)
if res.Error != nil { if res.Error != nil {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["b"] = "100" req.options["b"] = "100"
res = cmd.Call(req) res = cmd.Call(req)
if res.Error != nil { if res.Error != nil {
t.Error("Should have passed") t.Error("Should have passed")
} }
req = NewRequest() req = NewEmptyRequest()
req.options["b"] = ":)" req.options["b"] = ":)"
res = cmd.Call(req) res = cmd.Call(req)
if res.Error == nil { if res.Error == nil {
......
...@@ -11,7 +11,7 @@ type TestOutput struct { ...@@ -11,7 +11,7 @@ type TestOutput struct {
} }
func TestMarshalling(t *testing.T) { func TestMarshalling(t *testing.T) {
req := NewRequest() req := NewEmptyRequest()
res := Response{ res := Response{
req: req, req: req,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论