diff --git a/conformance/conformance.proto b/conformance/conformance.proto index fc96074ac8..e1b797ca01 100644 --- a/conformance/conformance.proto +++ b/conformance/conformance.proto @@ -210,6 +210,11 @@ message TestAllTypes { NestedMessage oneof_nested_message = 112; string oneof_string = 113; bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; } // Well-known types diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index d46fa8776e..88b05a5678 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -1256,6 +1256,21 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, message.set_oneof_bytes(""); RunValidProtobufTest( "OneofZeroBytes", message, "oneof_bytes: \"\""); + message.set_oneof_bool(false); + RunValidProtobufTest( + "OneofZeroBool", message, "oneof_bool: false"); + message.set_oneof_uint64(0); + RunValidProtobufTest( + "OneofZeroUint64", message, "oneof_uint64: 0"); + message.set_oneof_float(0.0f); + RunValidProtobufTest( + "OneofZeroFloat", message, "oneof_float: 0"); + message.set_oneof_double(0.0); + RunValidProtobufTest( + "OneofZeroDouble", message, "oneof_double: 0"); + message.set_oneof_enum(TestAllTypes::FOO); + RunValidProtobufTest( + "OneofZeroEnum", message, "oneof_enum: FOO"); } RunValidJsonTest( "OneofZeroUint32", @@ -1269,6 +1284,21 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, RunValidJsonTest( "OneofZeroBytes", R"({"oneofBytes": ""})", "oneof_bytes: \"\""); + RunValidJsonTest( + "OneofZeroBool", + R"({"oneofBool": false})", "oneof_bool: false"); + RunValidJsonTest( + "OneofZeroUint64", + R"({"oneofUint64": 0})", "oneof_uint64: 0"); + RunValidJsonTest( + "OneofZeroFloat", + R"({"oneofFloat": 0.0})", "oneof_float: 0"); + RunValidJsonTest( + "OneofZeroDouble", + R"({"oneofDouble": 0.0})", "oneof_double: 0"); + RunValidJsonTest( + "OneofZeroEnum", + R"({"oneofEnum":"FOO"})", "oneof_enum: FOO"); // Repeated fields. RunValidJsonTest( diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt index 1716bcbd1e..6f8a5b7c67 100644 --- a/conformance/failure_list_csharp.txt +++ b/conformance/failure_list_csharp.txt @@ -5,3 +5,23 @@ JsonInput.FieldNameWithMixedCases.JsonOutput JsonInput.FieldNameWithMixedCases.ProtobufOutput JsonInput.FieldNameWithMixedCases.Validator JsonInput.OriginalProtoFieldName.JsonOutput +JsonInput.OneofZeroBool.JsonOutput +JsonInput.OneofZeroBool.ProtobufOutput +JsonInput.OneofZeroDouble.JsonOutput +JsonInput.OneofZeroDouble.ProtobufOutput +JsonInput.OneofZeroEnum.JsonOutput +JsonInput.OneofZeroEnum.ProtobufOutput +JsonInput.OneofZeroFloat.JsonOutput +JsonInput.OneofZeroFloat.ProtobufOutput +JsonInput.OneofZeroUint64.JsonOutput +JsonInput.OneofZeroUint64.ProtobufOutput +ProtobufInput.OneofZeroBool.JsonOutput +ProtobufInput.OneofZeroBool.ProtobufOutput +ProtobufInput.OneofZeroDouble.JsonOutput +ProtobufInput.OneofZeroDouble.ProtobufOutput +ProtobufInput.OneofZeroEnum.JsonOutput +ProtobufInput.OneofZeroEnum.ProtobufOutput +ProtobufInput.OneofZeroFloat.JsonOutput +ProtobufInput.OneofZeroFloat.ProtobufOutput +ProtobufInput.OneofZeroUint64.JsonOutput +ProtobufInput.OneofZeroUint64.ProtobufOutput diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt index 526c2e7516..47d0c7375e 100644 --- a/conformance/failure_list_ruby.txt +++ b/conformance/failure_list_ruby.txt @@ -103,8 +103,14 @@ JsonInput.MessageMapField.JsonOutput JsonInput.MessageMapField.ProtobufOutput JsonInput.MessageRepeatedField.JsonOutput JsonInput.MessageRepeatedField.ProtobufOutput +JsonInput.OneofZeroDouble.JsonOutput +JsonInput.OneofZeroDouble.ProtobufOutput +JsonInput.OneofZeroFloat.JsonOutput +JsonInput.OneofZeroFloat.ProtobufOutput JsonInput.OneofZeroUint32.JsonOutput JsonInput.OneofZeroUint32.ProtobufOutput +JsonInput.OneofZeroUint64.JsonOutput +JsonInput.OneofZeroUint64.ProtobufOutput JsonInput.OptionalBoolWrapper.JsonOutput JsonInput.OptionalBoolWrapper.ProtobufOutput JsonInput.OptionalBytesWrapper.JsonOutput