Skip to content

Commit

Permalink
commands: Added tests for Request#SetOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Nov 18, 2014
1 parent c19bdf1 commit 8968b98
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion commands/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,26 @@ func TestOptionValidation(t *testing.T) {
t.Error("Should have passed")
}

req, _ = NewRequest(nil, nil, nil, nil, nil, opts)
req, _ = NewRequest(nil, nil, nil, nil, &cmd, opts)
req.SetOption("b", ":)")
res = cmd.Call(req)
if res.Error() == nil {
t.Error("Should have failed (string value not convertible to int)")
}

err := req.SetOptions(map[string]interface{}{
"b": 100,
})
if err != nil {
t.Error("Should have passed")
}

err = req.SetOptions(map[string]interface{}{
"b": ":)",
})
if err == nil {
t.Error("Should have failed (string value not convertible to int)")
}
}

func TestRegistration(t *testing.T) {
Expand Down

0 comments on commit 8968b98

Please sign in to comment.