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
5a17660c
Commit
5a17660c
authored
Sep 01, 2016
by
mike07026
Committed by
GitHub
Sep 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
detect invaild JSON encoding in bytes field
parent
e514f232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
json_util_test.cc
src/google/protobuf/util/json_util_test.cc
+28
-0
No files found.
src/google/protobuf/util/json_util_test.cc
View file @
5a17660c
...
...
@@ -128,6 +128,34 @@ TEST_F(JsonUtilTest, TestDefaultValues) {
"
\"
repeatedMessageValue
\"
:[]"
"}"
,
ToJson
(
m
,
options
));
options
.
always_print_primitive_fields
=
true
;
m
.
set_string_value
(
"i am a test string value"
);
m
.
set_bytes_value
(
"i am a test bytes value"
);
EXPECT_EQ
(
"{
\"
boolValue
\"
:false,"
"
\"
int32Value
\"
:0,"
"
\"
int64Value
\"
:
\"
0
\"
,"
"
\"
uint32Value
\"
:0,"
"
\"
uint64Value
\"
:
\"
0
\"
,"
"
\"
floatValue
\"
:0,"
"
\"
doubleValue
\"
:0,"
"
\"
stringValue
\"
:
\"
i am a test string value
\"
,"
"
\"
bytesValue
\"
:
\"
aSBhbSBhIHRlc3QgYnl0ZXMgdmFsdWU=
\"
,"
"
\"
enumValue
\"
:
\"
FOO
\"
,"
"
\"
repeatedBoolValue
\"
:[],"
"
\"
repeatedInt32Value
\"
:[],"
"
\"
repeatedInt64Value
\"
:[],"
"
\"
repeatedUint32Value
\"
:[],"
"
\"
repeatedUint64Value
\"
:[],"
"
\"
repeatedFloatValue
\"
:[],"
"
\"
repeatedDoubleValue
\"
:[],"
"
\"
repeatedStringValue
\"
:[],"
"
\"
repeatedBytesValue
\"
:[],"
"
\"
repeatedEnumValue
\"
:[],"
"
\"
repeatedMessageValue
\"
:[]"
"}"
,
ToJson
(
m
,
options
));
}
TEST_F
(
JsonUtilTest
,
ParseMessage
)
{
...
...
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