mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Added a conformance test for embedded nulls in JSON strings.
Going forward we will be forbidding `null` in `json_name`, but we will continue to support embedded `null` in JSON value. This conformance test will help clarify that this is a supported use case. PiperOrigin-RevId: 527918031
This commit is contained in:
parent
f6c7fdf88c
commit
37dfe806f8
1 changed files with 4 additions and 1 deletions
|
|
@ -2378,7 +2378,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForNonRepeatedTypes() {
|
|||
// String fields.
|
||||
RunValidJsonTest("StringField", REQUIRED,
|
||||
R"({"optionalString": "Hello world!"})",
|
||||
"optional_string: \"Hello world!\"");
|
||||
R"(optional_string: "Hello world!")");
|
||||
RunValidJsonTest("StringFieldUnicode", REQUIRED,
|
||||
// Google in Chinese.
|
||||
R"({"optionalString": "谷歌"})",
|
||||
|
|
@ -2397,6 +2397,9 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForNonRepeatedTypes() {
|
|||
// The character is an emoji: grinning face with smiling eyes. 😁
|
||||
R"({"optionalString": "\uD83D\uDE01"})",
|
||||
R"(optional_string: "\xF0\x9F\x98\x81")");
|
||||
RunValidJsonTest("StringFieldEmbeddedNull", REQUIRED,
|
||||
R"({"optionalString": "Hello\u0000world!"})",
|
||||
R"(optional_string: "Hello\000world!")");
|
||||
|
||||
// Unicode escapes must start with "\u" (lowercase u).
|
||||
ExpectParseFailureForJson("StringFieldUppercaseEscapeLetter", RECOMMENDED,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue