Skip to content

Commit

Permalink
Add conformance test for binary string (#6415)
Browse files Browse the repository at this point in the history
* Add conformance test for binary string

* Add failing tests to php failure list
  • Loading branch information
TeBoring committed Jul 22, 2019
1 parent 1bbae02 commit eef87dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion conformance/binary_json_conformance_suite.cc
Expand Up @@ -789,9 +789,18 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
{zz64(kInt64Max), std::to_string(kInt64Max)},
{zz64(kInt64Min), std::to_string(kInt64Min)}
});
TestValidDataForType(FieldDescriptor::TYPE_STRING, {
{delim("Hello world!"), "\"Hello world!\""},
{delim("\'\"\?\\\a\b\f\n\r\t\v"),
"\"\x27\\\"\x3F\\\\\x07\x08\x0C\\n\x0D\x09\x0B\""}, // escape
{delim("谷歌"), "\"谷歌\""}, // Google in Chinese
{delim("\u8C37\u6B4C"), "\"谷歌\""}, // unicode escape
{delim("\u8c37\u6b4c"), "\"谷歌\""}, // lowercase unicode
{delim("\xF0\x9F\x98\x81"), "\"\xF0\x9F\x98\x81\""}, // emoji: 😁
{delim(""), "\"\""},
});

// TODO(haberman):
// TestValidDataForType(FieldDescriptor::TYPE_STRING
// TestValidDataForType(FieldDescriptor::TYPE_GROUP
// TestValidDataForType(FieldDescriptor::TYPE_MESSAGE
// TestValidDataForType(FieldDescriptor::TYPE_BYTES
Expand Down
2 changes: 2 additions & 0 deletions conformance/failure_list_php_c.txt
Expand Up @@ -42,3 +42,5 @@ Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
Required.Proto3.JsonInput.RejectTopLevelNull
Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.JsonOutput
Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput

0 comments on commit eef87dd

Please sign in to comment.