aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args_test.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-17 04:49:51 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-17 04:49:51 +0800
commit176115e22ecc5e86179784ba5027c84e538423c4 (patch)
tree0449de8ec15c875da8a5bc4ac9649e1014b051fe /rpc/args_test.go
parent0339a138625aca8647e5d51488e6d679202cdddb (diff)
downloaddexon-176115e22ecc5e86179784ba5027c84e538423c4.tar.gz
dexon-176115e22ecc5e86179784ba5027c84e538423c4.tar.zst
dexon-176115e22ecc5e86179784ba5027c84e538423c4.zip
More empty param tests
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r--rpc/args_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go
index bdf05cad1..61b9dad25 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -159,6 +159,16 @@ func TestNewTxArgs(t *testing.T) {
}
}
+func TestNewTxArgsEmpty(t *testing.T) {
+ input := `[]`
+
+ args := new(NewTxArgs)
+ err := json.Unmarshal([]byte(input), &args)
+ if err == nil {
+ t.Error("Expected error but didn't get one")
+ }
+}
+
func TestGetStorageArgs(t *testing.T) {
input := `["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"]`
expected := new(GetStorageArgs)
@@ -183,6 +193,16 @@ func TestGetStorageArgs(t *testing.T) {
}
}
+func TestGetStorageEmptyArgs(t *testing.T) {
+ input := `[]`
+
+ args := new(GetStorageArgs)
+ err := json.Unmarshal([]byte(input), &args)
+ if err == nil {
+ t.Error("Expected error but didn't get one")
+ }
+}
+
func TestGetStorageAtArgs(t *testing.T) {
input := `["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "0x0", "0x2"]`
expected := new(GetStorageAtArgs)
@@ -212,6 +232,16 @@ func TestGetStorageAtArgs(t *testing.T) {
}
}
+func TestGetStorageAtEmptyArgs(t *testing.T) {
+ input := `[]`
+
+ args := new(GetStorageAtArgs)
+ err := json.Unmarshal([]byte(input), &args)
+ if err == nil {
+ t.Error("Expected error but didn't get one")
+ }
+}
+
func TestGetTxCountArgs(t *testing.T) {
input := `["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"]`
expected := new(GetTxCountArgs)
@@ -236,6 +266,16 @@ func TestGetTxCountArgs(t *testing.T) {
}
}
+func TestGetTxCountEmptyArgs(t *testing.T) {
+ input := `[]`
+
+ args := new(GetTxCountArgs)
+ err := json.Unmarshal([]byte(input), &args)
+ if err == nil {
+ t.Error("Expected error but didn't get one")
+ }
+}
+
func TestGetDataArgs(t *testing.T) {
input := `["0xd5677cf67b5aa051bb40496e68ad359eb97cfbf8", "latest"]`
expected := new(GetDataArgs)
@@ -260,6 +300,16 @@ func TestGetDataArgs(t *testing.T) {
}
}
+func TestGetDataEmptyArgs(t *testing.T) {
+ input := `[]`
+
+ args := new(GetDataArgs)
+ err := json.Unmarshal([]byte(input), &args)
+ if err == nil {
+ t.Error("Expected error but didn't get one")
+ }
+}
+
func TestFilterOptions(t *testing.T) {
input := `[{
"fromBlock": "0x1",