Commit 80f65d2d authored by Thomas Van Lenten's avatar Thomas Van Lenten Committed by GitHub

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.
parent b5794ed0
...@@ -111,7 +111,10 @@ conformance/conformance.pb.h ...@@ -111,7 +111,10 @@ conformance/conformance.pb.h
conformance/Conformance.pbobjc.h conformance/Conformance.pbobjc.h
conformance/Conformance.pbobjc.m conformance/Conformance.pbobjc.m
conformance/conformance_pb.rb conformance/conformance_pb.rb
conformance/failing_tests.txt
conformance/google/ conformance/google/
conformance/javac_middleman conformance/javac_middleman
conformance/lite/ conformance/lite/
conformance/nonexistent_tests.txt
conformance/protoc_middleman conformance/protoc_middleman
conformance/succeeding_tests.txt
...@@ -654,14 +654,16 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, ...@@ -654,14 +654,16 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
RunValidJsonTest("HelloWorld", "{\"optionalString\":\"Hello, World!\"}", RunValidJsonTest("HelloWorld", "{\"optionalString\":\"Hello, World!\"}",
"optional_string: '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. // Test field name conventions.
RunValidJsonTest( RunValidJsonTest(
"FieldNameInSnakeCase", "FieldNameInSnakeCase",
R"({ R"({
"fieldname1": 1, "fieldname1": 1,
"fieldName2": 2, "fieldName2": 2,
"FieldName3": 3, "fieldName3": 3,
"FieldName4": 4 "fieldName4": 4
})", })",
R"( R"(
fieldname1: 1 fieldname1: 1
...@@ -848,18 +850,22 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, ...@@ -848,18 +850,22 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"optionalNestedMessage": {a: 1}, "optionalNestedMessage": {a: 1},
"optional_nested_message": {} "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. // Serializers should use lowerCamelCase by default.
RunValidJsonTestWithValidator( RunValidJsonTestWithValidator(
"FieldNameInLowerCamelCase", "FieldNameInLowerCamelCase",
R"({ R"({
"fieldname1": 1, "fieldname1": 1,
"fieldName2": 2, "fieldName2": 2,
"FieldName3": 3 "fieldName3": 3,
"fieldName4": 4
})", })",
[](const Json::Value& value) { [](const Json::Value& value) {
return value.isMember("fieldname1") && return value.isMember("fieldname1") &&
value.isMember("fieldName2") && value.isMember("fieldName2") &&
value.isMember("FieldName3"); value.isMember("fieldName3") &&
value.isMember("fieldName4");
}); });
RunValidJsonTestWithValidator( RunValidJsonTestWithValidator(
"FieldNameWithNumbers", "FieldNameWithNumbers",
...@@ -889,6 +895,24 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, ...@@ -889,6 +895,24 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
value.isMember("fIELDNAME11") && value.isMember("fIELDNAME11") &&
value.isMember("fIELDName12"); 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. // Integer fields.
RunValidJsonTest( RunValidJsonTest(
......
...@@ -22,9 +22,6 @@ JsonInput.FieldMaskInvalidCharacter ...@@ -22,9 +22,6 @@ JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameDuplicate JsonInput.FieldNameDuplicate
JsonInput.FieldNameDuplicateDifferentCasing1 JsonInput.FieldNameDuplicateDifferentCasing1
JsonInput.FieldNameDuplicateDifferentCasing2 JsonInput.FieldNameDuplicateDifferentCasing2
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameNotQuoted JsonInput.FieldNameNotQuoted
JsonInput.MapFieldValueIsNull JsonInput.MapFieldValueIsNull
JsonInput.RepeatedFieldMessageElementIsNull JsonInput.RepeatedFieldMessageElementIsNull
......
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameWithMixedCases.JsonOutput JsonInput.FieldNameWithMixedCases.JsonOutput
JsonInput.FieldNameWithMixedCases.ProtobufOutput JsonInput.FieldNameWithMixedCases.ProtobufOutput
JsonInput.FieldNameWithMixedCases.Validator JsonInput.FieldNameWithMixedCases.Validator
......
...@@ -20,11 +20,13 @@ JsonInput.DoubleFieldNegativeInfinityNotQuoted ...@@ -20,11 +20,13 @@ JsonInput.DoubleFieldNegativeInfinityNotQuoted
JsonInput.EnumFieldNotQuoted JsonInput.EnumFieldNotQuoted
JsonInput.FieldMaskInvalidCharacter JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameDuplicate JsonInput.FieldNameDuplicate
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameNotQuoted JsonInput.FieldNameNotQuoted
JsonInput.FieldNameWithDoubleUnderscores.JsonOutput JsonInput.FieldNameWithDoubleUnderscores.JsonOutput
JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput
JsonInput.FieldNameWithDoubleUnderscores.Validator
JsonInput.FloatFieldInfinityNotQuoted JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted JsonInput.FloatFieldNegativeInfinityNotQuoted
......
...@@ -19,9 +19,6 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput ...@@ -19,9 +19,6 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput
JsonInput.EnumFieldUnknownValue.Validator JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMask.ProtobufOutput JsonInput.FieldMask.ProtobufOutput
JsonInput.FieldMaskInvalidCharacter JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FloatFieldInfinityNotQuoted JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted JsonInput.FloatFieldNegativeInfinityNotQuoted
......
...@@ -28,9 +28,6 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput ...@@ -28,9 +28,6 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput
JsonInput.EnumFieldUnknownValue.Validator JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMask.ProtobufOutput JsonInput.FieldMask.ProtobufOutput
JsonInput.FieldMaskInvalidCharacter JsonInput.FieldMaskInvalidCharacter
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FloatFieldInfinityNotQuoted JsonInput.FloatFieldInfinityNotQuoted
JsonInput.FloatFieldNanNotQuoted JsonInput.FloatFieldNanNotQuoted
JsonInput.FloatFieldNegativeInfinityNotQuoted JsonInput.FloatFieldNegativeInfinityNotQuoted
......
...@@ -58,10 +58,12 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput ...@@ -58,10 +58,12 @@ JsonInput.EnumFieldNumericValueZero.ProtobufOutput
JsonInput.EnumFieldUnknownValue.Validator JsonInput.EnumFieldUnknownValue.Validator
JsonInput.FieldMask.JsonOutput JsonInput.FieldMask.JsonOutput
JsonInput.FieldMask.ProtobufOutput JsonInput.FieldMask.ProtobufOutput
JsonInput.FieldNameInLowerCamelCase.Validator
JsonInput.FieldNameInSnakeCase.JsonOutput JsonInput.FieldNameInSnakeCase.JsonOutput
JsonInput.FieldNameInSnakeCase.ProtobufOutput JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameWithDoubleUnderscores.JsonOutput JsonInput.FieldNameWithDoubleUnderscores.JsonOutput
JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput
JsonInput.FieldNameWithDoubleUnderscores.Validator
JsonInput.FieldNameWithMixedCases.JsonOutput JsonInput.FieldNameWithMixedCases.JsonOutput
JsonInput.FieldNameWithMixedCases.ProtobufOutput JsonInput.FieldNameWithMixedCases.ProtobufOutput
JsonInput.FieldNameWithMixedCases.Validator JsonInput.FieldNameWithMixedCases.Validator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment