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
e8c1399b
Commit
e8c1399b
authored
Jul 03, 2015
by
Bas van Kervel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed unittest after new implementation
parent
d9efaf75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
37 deletions
+1
-37
json_test.go
rpc/codec/json_test.go
+1
-37
No files found.
rpc/codec/json_test.go
View file @
e8c1399b
...
@@ -112,42 +112,6 @@ func TestJsonDecoderWithValidBatchRequest(t *testing.T) {
...
@@ -112,42 +112,6 @@ func TestJsonDecoderWithValidBatchRequest(t *testing.T) {
}
}
}
}
func
TestJsonDecoderWithIncompleteMessage
(
t
*
testing
.
T
)
{
reqdata
:=
[]
byte
(
`{"jsonrpc":"2.0","method":"modules","pa`
)
decoder
:=
newJsonTestConn
(
reqdata
)
jsonDecoder
:=
NewJsonCoder
(
decoder
)
requests
,
batch
,
err
:=
jsonDecoder
.
ReadRequest
()
if
err
!=
io
.
EOF
{
t
.
Errorf
(
"Expected to read an incomplete request err but got %v"
,
err
)
}
// remaining message
decoder
.
Write
([]
byte
(
`rams":[],"id":64}`
))
requests
,
batch
,
err
=
jsonDecoder
.
ReadRequest
()
if
err
!=
nil
{
t
.
Errorf
(
"Read valid request failed - %v"
,
err
)
}
if
len
(
requests
)
!=
1
{
t
.
Errorf
(
"Expected to get a single request but got %d"
,
len
(
requests
))
}
if
batch
{
t
.
Errorf
(
"Got batch indication while expecting single request"
)
}
if
requests
[
0
]
.
Id
!=
float64
(
64
)
{
t
.
Errorf
(
"Expected req.Id == 64 but got %v"
,
requests
[
0
]
.
Id
)
}
if
requests
[
0
]
.
Method
!=
"modules"
{
t
.
Errorf
(
"Expected req.Method == 'modules' got '%s'"
,
requests
[
0
]
.
Method
)
}
}
func
TestJsonDecoderWithInvalidIncompleteMessage
(
t
*
testing
.
T
)
{
func
TestJsonDecoderWithInvalidIncompleteMessage
(
t
*
testing
.
T
)
{
reqdata
:=
[]
byte
(
`{"jsonrpc":"2.0","method":"modules","pa`
)
reqdata
:=
[]
byte
(
`{"jsonrpc":"2.0","method":"modules","pa`
)
decoder
:=
newJsonTestConn
(
reqdata
)
decoder
:=
newJsonTestConn
(
reqdata
)
...
@@ -155,7 +119,7 @@ func TestJsonDecoderWithInvalidIncompleteMessage(t *testing.T) {
...
@@ -155,7 +119,7 @@ func TestJsonDecoderWithInvalidIncompleteMessage(t *testing.T) {
jsonDecoder
:=
NewJsonCoder
(
decoder
)
jsonDecoder
:=
NewJsonCoder
(
decoder
)
requests
,
batch
,
err
:=
jsonDecoder
.
ReadRequest
()
requests
,
batch
,
err
:=
jsonDecoder
.
ReadRequest
()
if
err
!=
io
.
EOF
{
if
err
!=
io
.
E
rrUnexpectedE
OF
{
t
.
Errorf
(
"Expected to read an incomplete request err but got %v"
,
err
)
t
.
Errorf
(
"Expected to read an incomplete request err but got %v"
,
err
)
}
}
...
...
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