Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
ac1fdd16
Commit
ac1fdd16
authored
Dec 20, 2017
by
Ubuntu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
line breaks adjsted
parent
e68caa3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
json_util_test.cc
src/google/protobuf/util/json_util_test.cc
+12
-5
No files found.
src/google/protobuf/util/json_util_test.cc
View file @
ac1fdd16
...
...
@@ -459,19 +459,26 @@ TEST(ZeroCopyStreamByteSinkTest, TestAllInputOutputPatterns) {
}
TEST_F
(
JsonUtilTest
,
TestWrongJsonInput
)
{
using
namespace
google
::
protobuf
;
const
char
json
[]
=
"{
\"
unknown_field
\"
:
\"
some_value
\"
}"
;
google
::
protobuf
::
io
::
ArrayInputStream
input_stream
(
json
,
strlen
(
json
));
io
::
ArrayInputStream
input_stream
(
json
,
strlen
(
json
));
char
proto_buffer
[
10000
];
google
::
protobuf
::
io
::
ArrayOutputStream
output_stream
(
proto_buffer
,
sizeof
(
proto_buffer
));
io
::
ArrayOutputStream
output_stream
(
proto_buffer
,
sizeof
(
proto_buffer
));
std
::
string
message_type
=
"type.googleapis.com/proto3.TestMessage"
;
TypeResolver
*
resolver
=
NewTypeResolverForDescriptorPool
(
"type.googleapis.com"
,
DescriptorPool
::
generated_pool
());
TypeResolver
*
resolver
=
NewTypeResolverForDescriptorPool
(
"type.googleapis.com"
,
DescriptorPool
::
generated_pool
());
util
::
Status
result_status
=
util
::
JsonToBinaryStream
(
resolver
,
message_type
,
&
input_stream
,
&
output_stream
);
util
::
Status
result_status
=
util
::
JsonToBinaryStream
(
resolver
,
message_type
,
&
input_stream
,
&
output_stream
);
delete
resolver
;
EXPECT_FALSE
(
result_status
.
ok
());
EXPECT_EQ
(
result_status
.
error_code
(),
google
::
protobuf
::
util
::
error
::
INVALID_ARGUMENT
);
EXPECT_EQ
(
result_status
.
error_code
(),
google
::
protobuf
::
util
::
error
::
INVALID_ARGUMENT
);
}
}
// namespace
...
...
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