aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args_test.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-16 22:38:57 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-16 22:38:57 +0800
commit5757f547a6339c770a6d85ad067107d34878858f (patch)
treebfac5a1e4d08e65bee85a55dc7a6a43d5ef2b2eb /rpc/args_test.go
parent3cf51d5479ab91cee100c4ca04d9db3a848ff8d2 (diff)
downloaddexon-5757f547a6339c770a6d85ad067107d34878858f.tar
dexon-5757f547a6339c770a6d85ad067107d34878858f.tar.gz
dexon-5757f547a6339c770a6d85ad067107d34878858f.tar.bz2
dexon-5757f547a6339c770a6d85ad067107d34878858f.tar.lz
dexon-5757f547a6339c770a6d85ad067107d34878858f.tar.xz
dexon-5757f547a6339c770a6d85ad067107d34878858f.tar.zst
dexon-5757f547a6339c770a6d85ad067107d34878858f.zip
Allow latest/pending in filter options
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r--rpc/args_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go
index 47d79cc32..d6e4bee62 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -286,6 +286,29 @@ func TestFilterOptions(t *testing.T) {
// }
}
+func TestFilterOptionsWords(t *testing.T) {
+ input := `[{
+ "fromBlock": "latest",
+ "toBlock": "pending"
+ }]`
+ expected := new(FilterOptions)
+ expected.Earliest = 0
+ expected.Latest = -1
+
+ args := new(FilterOptions)
+ if err := json.Unmarshal([]byte(input), &args); err != nil {
+ t.Error(err)
+ }
+
+ if expected.Earliest != args.Earliest {
+ t.Errorf("Earliest shoud be %#v but is %#v", expected.Earliest, args.Earliest)
+ }
+
+ if expected.Latest != args.Latest {
+ t.Errorf("Latest shoud be %#v but is %#v", expected.Latest, args.Latest)
+ }
+}
+
func TestDbArgs(t *testing.T) {
input := `["0x74657374","0x6b6579","0x6d79537472696e67"]`
expected := new(DbArgs)