diff options
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r-- | rpc/args_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go index cfe6c0c45..e78981a41 100644 --- a/rpc/args_test.go +++ b/rpc/args_test.go @@ -355,6 +355,25 @@ func TestGetBlockByNumberArgsBlockHex(t *testing.T) { t.Errorf("IncludeTxs should be %v but is %v", expected.IncludeTxs, args.IncludeTxs) } } +func TestGetBlockByNumberArgsWords(t *testing.T) { + input := `["earliest", true]` + expected := new(GetBlockByNumberArgs) + expected.BlockNumber = 0 + expected.IncludeTxs = true + + args := new(GetBlockByNumberArgs) + if err := json.Unmarshal([]byte(input), &args); err != nil { + t.Error(err) + } + + if args.BlockNumber != expected.BlockNumber { + t.Errorf("BlockNumber should be %v but is %v", expected.BlockNumber, args.BlockNumber) + } + + if args.IncludeTxs != expected.IncludeTxs { + t.Errorf("IncludeTxs should be %v but is %v", expected.IncludeTxs, args.IncludeTxs) + } +} func TestGetBlockByNumberEmpty(t *testing.T) { input := `[]` |