Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
176115e2
Commit
176115e2
authored
Mar 16, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More empty param tests
parent
0339a138
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
args_test.go
rpc/args_test.go
+50
-0
util.go
rpc/util.go
+5
-0
No files found.
rpc/args_test.go
View file @
176115e2
...
...
@@ -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",
...
...
rpc/util.go
View file @
176115e2
...
...
@@ -45,6 +45,11 @@ func UnmarshalRawMessages(b []byte, iface interface{}, number *int64) (err error
return
NewDecodeParamError
(
err
.
Error
())
}
// Hrm... Occurs when no params
if
len
(
data
)
==
0
{
return
NewDecodeParamError
(
"No data"
)
}
// Number index determines the index in the array for a possible block number
numberIndex
:=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment