aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2016-08-23 08:19:45 -0400
committerGitHub <noreply@github.com>2016-08-23 08:19:45 -0400
commit80f65d2df82cc23eb92ef5355d638b9102074190 (patch)
tree7573a77e4b7b55aa39495dd8892d8f52eec1416a
parentb5794ed02420770bf58398581c1ca11e1c9a29d9 (diff)
downloadprotobuf-80f65d2df82cc23eb92ef5355d638b9102074190.tar.gz
protobuf-80f65d2df82cc23eb92ef5355d638b9102074190.tar.bz2
protobuf-80f65d2df82cc23eb92ef5355d638b9102074190.zip
Add note about JSON tests maybe being wrong. (#1992)
Add note about JSON tests maybe being wrong. - Add note about the JSON test maybe not being correct yet. - Add test to checks the generated names for double underscores to be sure they are what is expected.
-rw-r--r--.gitignore3
-rw-r--r--conformance/conformance_test.cc32
-rw-r--r--conformance/failure_list_cpp.txt3
-rw-r--r--conformance/failure_list_csharp.txt3
-rw-r--r--conformance/failure_list_java.txt2
-rw-r--r--conformance/failure_list_python.txt3
-rw-r--r--conformance/failure_list_python_cpp.txt3
-rw-r--r--conformance/failure_list_ruby.txt2
8 files changed, 35 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 8f12f220..052dd14d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -111,7 +111,10 @@ conformance/conformance.pb.h
conformance/Conformance.pbobjc.h
conformance/Conformance.pbobjc.m
conformance/conformance_pb.rb
+conformance/failing_tests.txt
conformance/google/
conformance/javac_middleman
conformance/lite/
+conformance/nonexistent_tests.txt
conformance/protoc_middleman
+conformance/succeeding_tests.txt
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index 05ca2719..fb963f68 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -654,14 +654,16 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
RunValidJsonTest("HelloWorld", "{\"optionalString\":\"Hello, World!\"}",
"optional_string: 'Hello, World!'");
+ // NOTE: The spec for JSON support is still being sorted out, these may not
+ // all be correct.
// Test field name conventions.
RunValidJsonTest(
"FieldNameInSnakeCase",
R"({
"fieldname1": 1,
"fieldName2": 2,
- "FieldName3": 3,
- "FieldName4": 4
+ "fieldName3": 3,
+ "fieldName4": 4
})",
R"(
fieldname1: 1
@@ -848,18 +850,22 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"optionalNestedMessage": {a: 1},
"optional_nested_message": {}
})");
+ // NOTE: The spec for JSON support is still being sorted out, these may not
+ // all be correct.
// Serializers should use lowerCamelCase by default.
RunValidJsonTestWithValidator(
"FieldNameInLowerCamelCase",
R"({
"fieldname1": 1,
"fieldName2": 2,
- "FieldName3": 3
+ "fieldName3": 3,
+ "fieldName4": 4
})",
[](const Json::Value& value) {
return value.isMember("fieldname1") &&
value.isMember("fieldName2") &&
- value.isMember("FieldName3");
+ value.isMember("fieldName3") &&
+ value.isMember("fieldName4");
});
RunValidJsonTestWithValidator(
"FieldNameWithNumbers",
@@ -889,6 +895,24 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
value.isMember("fIELDNAME11") &&
value.isMember("fIELDName12");
});
+ RunValidJsonTestWithValidator(
+ "FieldNameWithDoubleUnderscores",
+ R"({
+ "fieldName13": 13,
+ "fieldName14": 14,
+ "fieldName15": 15,
+ "fieldName16": 16,
+ "fieldName17": 17,
+ "fieldName18": 18
+ })",
+ [](const Json::Value& value) {
+ return value.isMember("fieldName13") &&
+ value.isMember("fieldName14") &&
+ value.isMember("fieldName15") &&
+ value.isMember("fieldName16") &&
+ value.isMember("fieldName17") &&
+ value.isMember("fieldName18");
+ });
// Integer fields.
RunValidJsonTest(
diff --git a/conformance/failure_list_cpp.txt b/conformance/failure_list_cpp.txt
index 0f1c9414..5e17176e 100644
--- a/conformance/failure_list_cpp.txt
+++ b/conformance/failure_list_cpp.txt
@@ -22,9 +22,6 @@ JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameDuplicate
JsonInput.FieldNameDuplicateDifferentCasing1
JsonInput.FieldNameDuplicateDifferentCasing2
-JsonInput.FieldNameInLowerCamelCase.Validator
-JsonInput.FieldNameInSnakeCase.JsonOutput
-JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameNotQuoted
JsonInput.MapFieldValueIsNull
JsonInput.RepeatedFieldMessageElementIsNull
diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt
index 1716bcbd..d8bfe1bb 100644
--- a/conformance/failure_list_csharp.txt
+++ b/conformance/failure_list_csharp.txt
@@ -1,6 +1,3 @@
-JsonInput.FieldNameInLowerCamelCase.Validator
-JsonInput.FieldNameInSnakeCase.JsonOutput
-JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameWithMixedCases.JsonOutput
JsonInput.FieldNameWithMixedCases.ProtobufOutput
JsonInput.FieldNameWithMixedCases.Validator
diff --git a/conformance/failure_list_java.txt b/conformance/failure_list_java.txt
index 6bf91940..b2122c8b 100644
--- a/conformance/failure_list_java.txt
+++ b/conformance/failure_list_java.txt
@@ -20,11 +20,13 @@ JsonInput.DoubleFieldNegativeInfinityNotQuoted
JsonInput.EnumFieldNotQuoted
JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameDuplicate
+JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameNotQuoted
JsonInput.FieldNameWithDoubleUnderscores.JsonOutput
JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput
+JsonInput.FieldNameWithDoubleUnderscores.Validator
JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted
diff --git a/conformance/failure_list_python.txt b/conformance/failure_list_python.txt
index 3918703a..d38b7828 100644
--- a/conformance/failure_list_python.txt
+++ b/conformance/failure_list_python.txt
@@ -19,9 +19,6 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput
JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMask.ProtobufOutput
JsonInput.FieldMaskInvalidCharacter
-JsonInput.FieldNameInLowerCamelCase.Validator
-JsonInput.FieldNameInSnakeCase.JsonOutput
-JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted
diff --git a/conformance/failure_list_python_cpp.txt b/conformance/failure_list_python_cpp.txt
index 69746d9f..84d9fccd 100644
--- a/conformance/failure_list_python_cpp.txt
+++ b/conformance/failure_list_python_cpp.txt
@@ -28,9 +28,6 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput
JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMask.ProtobufOutput
JsonInput.FieldMaskInvalidCharacter
-JsonInput.FieldNameInLowerCamelCase.Validator
-JsonInput.FieldNameInSnakeCase.JsonOutput
-JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted
diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt
index 11428f48..2a533aa5 100644
--- a/conformance/failure_list_ruby.txt
+++ b/conformance/failure_list_ruby.txt
@@ -58,10 +58,12 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput
JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMask.JsonOutput
JsonInput.FieldMask.ProtobufOutput
+JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameWithDoubleUnderscores.JsonOutput
JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput
+JsonInput.FieldNameWithDoubleUnderscores.Validator
JsonInput.FieldNameWithMixedCases.JsonOutput
JsonInput.FieldNameWithMixedCases.ProtobufOutput
JsonInput.FieldNameWithMixedCases.Validator