|
|
|
@ -972,6 +972,21 @@ TEST_P(JsonTest, TestParsingUnknownEnumsProto3FromArray) { |
|
|
|
|
StatusIs(absl::StatusCode::kInvalidArgument)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(JsonTest, TestParsingRepeatedUnknownEnums) { |
|
|
|
|
absl::string_view input = R"json({ |
|
|
|
|
"repeated_enum_value": ["FOO", "BAZ", "BAR"] |
|
|
|
|
})json"; |
|
|
|
|
|
|
|
|
|
EXPECT_THAT(ToProto<TestMessage>(input), |
|
|
|
|
StatusIs(absl::StatusCode::kInvalidArgument)); |
|
|
|
|
|
|
|
|
|
ParseOptions options; |
|
|
|
|
options.ignore_unknown_fields = true; |
|
|
|
|
auto m = ToProto<TestMessage>(input, options); |
|
|
|
|
ASSERT_OK(m); |
|
|
|
|
EXPECT_THAT(m->repeated_enum_value(), ElementsAre(proto3::FOO, proto3::BAR)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(JsonTest, TestParsingEnumCaseSensitive) { |
|
|
|
|
TestMessage m; |
|
|
|
|
m.set_enum_value(proto3::FOO); |
|
|
|
@ -1279,8 +1294,7 @@ TEST_P(JsonTest, FieldOrder) { |
|
|
|
|
"\x18\x03\xb0\x01\x02\x08\x01\xb0\x01\x02", &out); |
|
|
|
|
ASSERT_OK(s); |
|
|
|
|
EXPECT_EQ( |
|
|
|
|
out, |
|
|
|
|
R"({"boolValue":true,"int64Value":"3","repeatedInt32Value":[2,2]})"); |
|
|
|
|
out, R"({"boolValue":true,"int64Value":"3","repeatedInt32Value":[2,2]})"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// JSON values get special treatment when it comes to pre-existing values in
|
|
|
|
|