New args types with stricter checking

This commit is contained in:
Taylor Gerring
2015-04-02 13:17:55 +02:00
parent 14c14fd61f
commit e402e1dc2e
3 changed files with 82 additions and 36 deletions

View File

@ -225,7 +225,7 @@ func TestGetBlockByHashArgsHashInt(t *testing.T) {
input := `[8]`
args := new(GetBlockByHashArgs)
str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), &args))
str := ExpectInsufficientParamsError(json.Unmarshal([]byte(input), &args))
if len(str) > 0 {
t.Error(str)
}
@ -281,6 +281,16 @@ func TestGetBlockByNumberEmpty(t *testing.T) {
}
}
func TestGetBlockByNumberShort(t *testing.T) {
input := `["0xbbb"]`
args := new(GetBlockByNumberArgs)
str := ExpectInsufficientParamsError(json.Unmarshal([]byte(input), &args))
if len(str) > 0 {
t.Error(str)
}
}
func TestGetBlockByNumberBool(t *testing.T) {
input := `[true, true]`