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
93af30a6
Commit
93af30a6
authored
Mar 26, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved GetBlockByHashArgs tests
parent
bd1a54f0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
2 deletions
+37
-2
args_test.go
rpc/args_test.go
+37
-2
No files found.
rpc/args_test.go
View file @
93af30a6
...
@@ -100,13 +100,48 @@ func TestGetBlockByHashArgs(t *testing.T) {
...
@@ -100,13 +100,48 @@ func TestGetBlockByHashArgs(t *testing.T) {
}
}
}
}
func
TestGetBlockByHashEmpty
(
t
*
testing
.
T
)
{
func
TestGetBlockByHash
Args
Empty
(
t
*
testing
.
T
)
{
input
:=
`[]`
input
:=
`[]`
args
:=
new
(
GetBlockByHashArgs
)
args
:=
new
(
GetBlockByHashArgs
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
if
err
==
nil
{
switch
err
.
(
type
)
{
case
nil
:
t
.
Error
(
"Expected error but didn't get one"
)
case
*
InsufficientParamsError
:
break
default
:
t
.
Errorf
(
"Expected *rpc.InsufficientParamsError but got %T with message %s"
,
err
,
err
.
Error
())
}
}
func
TestGetBlockByHashArgsInvalid
(
t
*
testing
.
T
)
{
input
:=
`{}`
args
:=
new
(
GetBlockByHashArgs
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
switch
err
.
(
type
)
{
case
nil
:
t
.
Error
(
"Expected error but didn't get one"
)
t
.
Error
(
"Expected error but didn't get one"
)
case
*
DecodeParamError
:
break
default
:
t
.
Errorf
(
"Expected *rpc.DecodeParamError but got %T with message %s"
,
err
,
err
.
Error
())
}
}
func
TestGetBlockByHashArgsHashInt
(
t
*
testing
.
T
)
{
input
:=
`[8]`
args
:=
new
(
GetBlockByHashArgs
)
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
)
switch
err
.
(
type
)
{
case
nil
:
t
.
Error
(
"Expected error but didn't get one"
)
case
*
DecodeParamError
:
break
default
:
t
.
Errorf
(
"Expected *rpc.DecodeParamError but got %T with message %s"
,
err
,
err
.
Error
())
}
}
}
}
...
...
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