commands: Added a option validation test for convertible string values
Matt Bell committed
Oct 14, 2014 at 17:39 UTC
47eea7fd93d2f9fce4150451f83218895ba6e785
1 file changed
+14
commands/command_test.go
+14
@@ -62,6 +62,20 @@ func TestOptionValidation(t *testing.T) {
62
if res.Error != nil {
63
t.Error("Should have passed")
64
}
65
+
66
+ req = NewRequest()
67
+ req.options["b"] = "100"
68
+ res = cmd.Call(req)
69
+ if res.Error != nil {
70
+ t.Error("Should have passed")
71
+ }
72
+
73
+ req = NewRequest()
74
+ req.options["b"] = ":)"
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
+ }
79
}
80
81
func TestRegistration(t *testing.T) {