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
d83a9f66
Commit
d83a9f66
authored
Aug 30, 2018
by
Brandon Cole
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for loading unknown fields in Any messages
Use ./tests.sh cpp to run it
parent
45d03a97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
json_util_test.cc
src/google/protobuf/util/json_util_test.cc
+18
-0
No files found.
src/google/protobuf/util/json_util_test.cc
View file @
d83a9f66
...
...
@@ -56,6 +56,7 @@ using proto3::TestEnumValue;
using
proto3
::
TestMap
;
using
proto3
::
TestMessage
;
using
proto3
::
TestOneof
;
using
proto3
::
TestAny
;
static
const
char
kTypeUrlPrefix
[]
=
"type.googleapis.com"
;
...
...
@@ -357,6 +358,23 @@ TEST_F(JsonUtilTest, TestDynamicMessage) {
EXPECT_EQ
(
ToJson
(
generated
,
options
),
ToJson
(
*
message
,
options
));
}
TEST_F
(
JsonUtilTest
,
TestParsingUnknownAnyFields
)
{
string
input
=
"{
\n
"
"
\"
value
\"
: {
\n
"
"
\"
@type
\"
:
\"
type.googleapis.com/proto3.TestMessage
\"
,
\n
"
"
\"
unknown_field
\"
:
\"
UNKOWN_VALUE
\"\n
"
" }
\n
"
"}"
;
TestAny
m
;
JsonParseOptions
options
;
EXPECT_FALSE
(
FromJson
(
input
,
&
m
,
options
));
options
.
ignore_unknown_fields
=
true
;
EXPECT_TRUE
(
FromJson
(
input
,
&
m
,
options
));
}
TEST_F
(
JsonUtilTest
,
TestParsingUnknownEnumsProto2
)
{
string
input
=
"{
\n
"
...
...
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