add proto2 supported for cpp,python,nodejs,ruby,php

pull/3281/head
Yilun Chong 8 years ago
parent 2ad74e1606
commit 18a0c2c4d2
  1. BIN
      conformance/ConformanceJava$1.class
  2. BIN
      conformance/ConformanceJava$BinaryDecoder$1.class
  3. BIN
      conformance/ConformanceJava$BinaryDecoder$2.class
  4. BIN
      conformance/ConformanceJava$BinaryDecoder$3.class
  5. BIN
      conformance/ConformanceJava$BinaryDecoder$4.class
  6. BIN
      conformance/ConformanceJava$BinaryDecoder$5.class
  7. BIN
      conformance/ConformanceJava$BinaryDecoder$6.class
  8. BIN
      conformance/ConformanceJava$BinaryDecoder$7.class
  9. BIN
      conformance/ConformanceJava$BinaryDecoder.class
  10. BIN
      conformance/ConformanceJava.class
  11. 43
      conformance/conformance_cpp.cc
  12. 20
      conformance/conformance_nodejs.js
  13. 11
      conformance/conformance_php.php
  14. 119
      conformance/conformance_php.php~
  15. 33
      conformance/conformance_python.py
  16. 4
      conformance/conformance_ruby.rb
  17. 131
      conformance/conformance_ruby.rb~
  18. 32
      conformance/conformance_test.cc
  19. 135
      conformance/failure_list_ruby.txt~
  20. 1
      python/setup.py
  21. 17
      ruby/lib/google/protobuf/any_pb.rb
  22. 39
      ruby/lib/google/protobuf/api_pb.rb
  23. 17
      ruby/lib/google/protobuf/duration_pb.rb
  24. 15
      ruby/lib/google/protobuf/empty_pb.rb
  25. 16
      ruby/lib/google/protobuf/field_mask_pb.rb
  26. 16
      ruby/lib/google/protobuf/source_context_pb.rb
  27. 35
      ruby/lib/google/protobuf/struct_pb.rb
  28. 17
      ruby/lib/google/protobuf/timestamp_pb.rb
  29. 89
      ruby/lib/google/protobuf/type_pb.rb
  30. 48
      ruby/lib/google/protobuf/wrappers_pb.rb
  31. 74
      ruby/tests/generated_code_pb.rb
  32. 13
      ruby/tests/test_import_pb.rb

Binary file not shown.

@ -34,6 +34,7 @@
#include "conformance.pb.h"
#include <google/protobuf/test_messages_proto3.pb.h>
#include <google/protobuf/test_messages_proto2.pb.h>
#include <google/protobuf/util/json_util.h>
#include <google/protobuf/util/type_resolver_util.h>
@ -48,6 +49,7 @@ using google::protobuf::util::NewTypeResolverForDescriptorPool;
using google::protobuf::util::Status;
using google::protobuf::util::TypeResolver;
using protobuf_test_messages::proto3::TestAllTypes;
using protobuf_test_messages::proto2::TestAllTypesProto2;
using std::string;
static const char kTypeUrlPrefix[] = "type.googleapis.com";
@ -88,16 +90,29 @@ void CheckedWrite(int fd, const void *buf, size_t len) {
void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
TestAllTypes test_message;
TestAllTypesProto2 test_message_proto2;
bool isProto3 = request.message_type() == "proto3";
bool isJson = request.payload_case() == ConformanceRequest::kJsonPayload;
switch (request.payload_case()) {
case ConformanceRequest::kProtobufPayload:
if (!test_message.ParseFromString(request.protobuf_payload())) {
// Getting parse details would involve something like:
// http://stackoverflow.com/questions/22121922/how-can-i-get-more-details-about-errors-generated-during-protobuf-parsing-c
response->set_parse_error("Parse error (no more details available).");
return;
case ConformanceRequest::kProtobufPayload: {
if (isProto3) {
if (!test_message.ParseFromString(request.protobuf_payload())) {
// Getting parse details would involve something like:
// http://stackoverflow.com/questions/22121922/how-can-i-get-more-details-about-errors-generated-during-protobuf-parsing-c
response->set_parse_error("Parse error (no more details available).");
return;
}
} else if (request.message_type() == "proto2") {
if (!test_message_proto2.ParseFromString(request.protobuf_payload())) {
response->set_parse_error("Parse error (no more details available).");
return;
}
} else {
GOOGLE_LOG(FATAL) << "Protobuf request doesn't have specific payload type";
}
break;
}
case ConformanceRequest::kJsonPayload: {
string proto_binary;
@ -127,14 +142,22 @@ void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
GOOGLE_LOG(FATAL) << "Unspecified output format";
break;
case conformance::PROTOBUF:
GOOGLE_CHECK(
test_message.SerializeToString(response->mutable_protobuf_payload()));
case conformance::PROTOBUF: {
(isProto3 || isJson) ?
GOOGLE_CHECK(
test_message.SerializeToString(response->mutable_protobuf_payload()))
:
GOOGLE_CHECK(
test_message_proto2.SerializeToString(response->mutable_protobuf_payload()));
break;
}
case conformance::JSON: {
string proto_binary;
GOOGLE_CHECK(test_message.SerializeToString(&proto_binary));
(isProto3 || isJson) ?
GOOGLE_CHECK(test_message.SerializeToString(&proto_binary))
:
GOOGLE_CHECK(test_message_proto2.SerializeToString(&proto_binary));
Status status = BinaryToJsonString(type_resolver, *type_url, proto_binary,
response->mutable_json_payload());
if (!status.ok()) {

@ -49,14 +49,22 @@ function doTest(request) {
}
switch (request.getPayloadCase()) {
case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD:
try {
testMessage = test_messages_proto3.TestAllTypes.deserializeBinary(
request.getProtobufPayload());
} catch (err) {
response.setParseError(err.toString());
case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD: {
if (request.getMessageType() == "proto3") {
try {
testMessage = test_messages_proto3.TestAllTypes.deserializeBinary(
request.getProtobufPayload());
} catch (err) {
response.setParseError(err.toString());
return response;
}
} else if (request.getMessageType() == "proto2"){
response.setSkipped("NodeJS doesn\'t support proto2");
return response;
} else {
throw "Protobuf request doesn\'t have specific payload type";
}
}
case conformance.ConformanceRequest.PayloadCase.JSON_PAYLOAD:
response.setSkipped("JSON not supported.");

@ -45,11 +45,18 @@ function doTest($request)
$test_message = new \Protobuf_test_messages\Proto3\TestAllTypes();
$response = new \Conformance\ConformanceResponse();
if ($request->getPayload() == "protobuf_payload") {
try {
if ($request->getMessageType() == "proto3") {
try {
$test_message->mergeFromString($request->getProtobufPayload());
} catch (Exception $e) {
} catch (Exception $e) {
$response->setParseError($e->getMessage());
return $response;
}
} elseif ($request->getMessageType() == "proto2") {
$response->setSkipped("PHP doesn't support proto2");
return $response;
} else {
trigger_error("Protobuf request doesn't have specific payload type", E_USER_ERROR);
}
} elseif ($request->getPayload() == "json_payload") {
try {

@ -0,0 +1,119 @@
<?php
require_once("Conformance/WireFormat.php");
require_once("Conformance/ConformanceResponse.php");
require_once("Conformance/ConformanceRequest.php");
require_once("Google/Protobuf/Any.php");
require_once("Google/Protobuf/Duration.php");
require_once("Google/Protobuf/FieldMask.php");
require_once("Google/Protobuf/Struct.php");
require_once("Google/Protobuf/Value.php");
require_once("Google/Protobuf/ListValue.php");
require_once("Google/Protobuf/NullValue.php");
require_once("Google/Protobuf/Timestamp.php");
require_once("Google/Protobuf/DoubleValue.php");
require_once("Google/Protobuf/BytesValue.php");
require_once("Google/Protobuf/FloatValue.php");
require_once("Google/Protobuf/Int64Value.php");
require_once("Google/Protobuf/UInt32Value.php");
require_once("Google/Protobuf/BoolValue.php");
require_once("Google/Protobuf/DoubleValue.php");
require_once("Google/Protobuf/Int32Value.php");
require_once("Google/Protobuf/StringValue.php");
require_once("Google/Protobuf/UInt64Value.php");
require_once("Protobuf_test_messages/Proto3/ForeignMessage.php");
require_once("Protobuf_test_messages/Proto3/ForeignEnum.php");
require_once("Protobuf_test_messages/Proto3/TestAllTypes.php");
require_once("Protobuf_test_messages/Proto3/TestAllTypes_NestedMessage.php");
require_once("Protobuf_test_messages/Proto3/TestAllTypes_NestedEnum.php");
require_once("GPBMetadata/Conformance.php");
require_once("GPBMetadata/Google/Protobuf/Any.php");
require_once("GPBMetadata/Google/Protobuf/Duration.php");
require_once("GPBMetadata/Google/Protobuf/FieldMask.php");
require_once("GPBMetadata/Google/Protobuf/Struct.php");
require_once("GPBMetadata/Google/Protobuf/Timestamp.php");
require_once("GPBMetadata/Google/Protobuf/Wrappers.php");
require_once("GPBMetadata/Google/Protobuf/TestMessagesProto3.php");
use \Conformance\WireFormat;
$test_count = 0;
function doTest($request)
{
$test_message = new \Protobuf_test_messages\Proto3\TestAllTypes();
$response = new \Conformance\ConformanceResponse();
if ($request->getPayload() == "protobuf_payload") {
if ($request->getMessageType() == "proto3") {
try {
$test_message->mergeFromString($request->getProtobufPayload());
} catch (Exception $e) {
$response->setParseError($e->getMessage());
return $response;
}
} elseif ($request->getMessageType() == "proto2") {
$response->setSkipped("PHP doesn't support proto2");
return $response;
} else {
trigger_error("Protobuf request doesn't have specific payload type", E_USER_ERROR);
}
} elseif ($request->getPayload() == "json_payload") {
try {
$test_message->jsonDecode($request->getJsonPayload());
} catch (Exception $e) {
$response->setParseError($e->getMessage());
return $response;
}
} else {
trigger_error("Request didn't have payload.", E_USER_ERROR);
}
if ($request->getRequestedOutputFormat() == WireFormat::UNSPECIFIED) {
trigger_error("Unspecified output format.", E_USER_ERROR);
} elseif ($request->getRequestedOutputFormat() == WireFormat::PROTOBUF) {
$response->setProtobufPayload($test_message->serializeToString());
} elseif ($request->getRequestedOutputFormat() == WireFormat::JSON) {
$response->setJsonPayload($test_message->jsonEncode());
}
return $response;
}
function doTestIO()
{
$length_bytes = fread(STDIN, 4);
if (strlen($length_bytes) == 0) {
return false; # EOF
} elseif (strlen($length_bytes) != 4) {
trigger_error("I/O error", E_USER_ERROR);
}
$length = unpack("V", $length_bytes)[1];
$serialized_request = fread(STDIN, $length);
if (strlen($serialized_request) != $length) {
trigger_error("I/O error", E_USER_ERROR);
}
$request = new \Conformance\ConformanceRequest();
$request->mergeFromString($serialized_request);
$response = doTest($request);
$serialized_response = $response->serializeToString();
fwrite(STDOUT, pack("V", strlen($serialized_response)));
fwrite(STDOUT, $serialized_response);
$GLOBALS['test_count'] += 1;
return true;
}
while(true){
if (!doTestIO()) {
fprintf(STDERR,
"conformance_php: received EOF from test runner " +
"after %d tests, exiting\n", $test_count);
exit;
}
}

@ -41,6 +41,7 @@ import os
from google.protobuf import json_format
from google.protobuf import message
from google.protobuf import test_messages_proto3_pb2
from google.protobuf import test_messages_proto2_pb2
import conformance_pb2
sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0)
@ -56,14 +57,26 @@ def do_test(request):
test_message = test_messages_proto3_pb2.TestAllTypes()
response = conformance_pb2.ConformanceResponse()
test_message = test_messages_proto3_pb2.TestAllTypes()
test_message_proto2 = test_messages_proto2_pb2.TestAllTypesProto2()
isProto3 = (request.message_type == "proto3")
isJson = (request.WhichOneof('payload') == 'json_payload')
try:
if request.WhichOneof('payload') == 'protobuf_payload':
try:
test_message.ParseFromString(request.protobuf_payload)
except message.DecodeError as e:
response.parse_error = str(e)
return response
if isProto3:
try:
test_message.ParseFromString(request.protobuf_payload)
except message.DecodeError as e:
response.parse_error = str(e)
return response
elif request.message_type == "proto2":
try:
test_message_proto2.ParseFromString(request.protobuf_payload)
except message.DecodeError as e:
response.parse_error = str(e)
return response
else:
raise ProtocolError("Protobuf request doesn't have specific payload type")
elif request.WhichOneof('payload') == 'json_payload':
try:
@ -79,11 +92,17 @@ def do_test(request):
raise ProtocolError("Unspecified output format")
elif request.requested_output_format == conformance_pb2.PROTOBUF:
response.protobuf_payload = test_message.SerializeToString()
if isProto3 or isJson:
response.protobuf_payload = test_message.SerializeToString()
else:
response.protobuf_payload = test_message_proto2.SerializeToString()
elif request.requested_output_format == conformance_pb2.JSON:
try:
response.json_payload = json_format.MessageToJson(test_message)
if isProto3 or isJson:
response.json_payload = json_format.MessageToJson(test_message)
else:
response.json_payload = json_format.MessageToJson(test_message_proto2)
except Exception as e:
response.serialize_error = str(e)
return response

@ -53,9 +53,9 @@ def do_test(request)
end
elsif request.message_type.eql?('proto2')
response.skipped = "Ruby doesn't support proto2"
return respons
return response
else
fail "Protobuf request doesn't have specific type"
fail "Protobuf request doesn't have specific payload type"
end
when :json_payload

@ -0,0 +1,131 @@
#!/usr/bin/env ruby
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'conformance_pb'
require 'google/protobuf/test_messages_proto3_pb'
$test_count = 0
$verbose = false
def do_test(request)
test_message = ProtobufTestMessages::Proto3::TestAllTypes.new
response = Conformance::ConformanceResponse.new
begin
case request.payload
when :protobuf_payload
if request.message_type.eql?('proto3')
begin
test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode(
request.protobuf_payload)
rescue Google::Protobuf::ParseError => err
response.parse_error = err.message.encode('utf-8')
return response
end
elsif request.message_type.eql?('proto2')
response.skipped = "Ruby doesn't support proto2"
return response
else
fail "Protobuf request doesn't have specific type"
end
when :json_payload
begin
test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode_json(
request.json_payload)
rescue Google::Protobuf::ParseError => err
response.parse_error = err.message.encode('utf-8')
return response
end
when nil
fail "Request didn't have payload"
end
case request.requested_output_format
when :UNSPECIFIED
fail 'Unspecified output format'
when :PROTOBUF
response.protobuf_payload = test_message.to_proto
when :JSON
response.json_payload = test_message.to_json
when nil
fail "Request didn't have requested output format"
end
rescue StandardError => err
response.runtime_error = err.message.encode('utf-8')
end
response
end
# Returns true if the test ran successfully, false on legitimate EOF.
# If EOF is encountered in an unexpected place, raises IOError.
def do_test_io
length_bytes = STDIN.read(4)
return false if length_bytes.nil?
length = length_bytes.unpack('V').first
serialized_request = STDIN.read(length)
if serialized_request.nil? || serialized_request.length != length
fail IOError
end
request = Conformance::ConformanceRequest.decode(serialized_request)
response = do_test(request)
serialized_response = Conformance::ConformanceResponse.encode(response)
STDOUT.write([serialized_response.length].pack('V'))
STDOUT.write(serialized_response)
STDOUT.flush
if $verbose
STDERR.puts("conformance_ruby: request=#{request.to_json}, " \
"response=#{response.to_json}\n")
end
$test_count += 1
true
end
loop do
unless do_test_io
STDERR.puts('conformance_ruby: received EOF from test runner ' \
"after #{$test_count} tests, exiting")
break
end
end

@ -277,8 +277,13 @@ void ConformanceTestSuite::RunValidInputTest(
WireFormat input_format, const string& equivalent_text_format,
WireFormat requested_output, bool isProto3) {
TestAllTypes reference_message;
TestAllTypesProto2 reference_message_proto2;
GOOGLE_CHECK(
TextFormat::ParseFromString(equivalent_text_format, &reference_message))
isProto3 ?
TextFormat::ParseFromString(equivalent_text_format, &reference_message)
:
TextFormat::ParseFromString(equivalent_text_format, &reference_message_proto2)
)
<< "Failed to parse data for test case: " << test_name
<< ", data: " << equivalent_text_format;
@ -401,7 +406,13 @@ void ConformanceTestSuite::RunValidInputTest(
string differences;
differencer.ReportDifferencesToString(&differences);
if (differencer.Compare(reference_message, test_message)) {
bool check;
if (isProto3) {
check = differencer.Compare(reference_message, test_message);
} else {
check = differencer.Compare(reference_message_proto2, test_message_proto2);
}
if (check) {
ReportSuccess(test_name);
} else {
ReportFailure(test_name, level, request, response,
@ -477,12 +488,16 @@ void ConformanceTestSuite::RunValidProtobufTest(
const string& test_name, ConformanceLevel level,
const string& input_protobuf, const string& equivalent_text_format,
bool isProto3) {
string rname = ".ProtobufInput.";
if (!isProto3) {
rname = ".Protobuf2Input.";
}
RunValidInputTest(
ConformanceLevelToString(level) + ".ProtobufInput." + test_name +
ConformanceLevelToString(level) + rname + test_name +
".ProtobufOutput", level, input_protobuf, conformance::PROTOBUF,
equivalent_text_format, conformance::PROTOBUF, isProto3);
RunValidInputTest(
ConformanceLevelToString(level) + ".ProtobufInput." + test_name +
ConformanceLevelToString(level) + rname + test_name +
".JsonOutput", level, input_protobuf, conformance::PROTOBUF,
equivalent_text_format, conformance::JSON, isProto3);
}
@ -704,7 +719,8 @@ void ConformanceTestSuite::TestValidDataForType(
proto += cat(tag(rep_field->number(), wire_type), values[i].first);
text += rep_field->name() + ": " + values[i].second + " ";
}
RunValidProtobufTest("ValidDataRepeated" + type_name, REQUIRED, proto, text, true);
RunValidProtobufTest("ValidDataRepeated" + type_name, REQUIRED,
proto, text, isProto3);
}
void ConformanceTestSuite::SetFailureList(const string& filename,
@ -796,6 +812,12 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
{dbl(1.7976931348623157e+308), "1.7976931348623157e+308"},
{dbl(2.22507385850720138309e-308), "2.22507385850720138309e-308"}
}, true);
TestValidDataForType(FieldDescriptor::TYPE_DOUBLE, {
{dbl(0.1), "0.1"},
{dbl(1.7976931348623157e+308), "1.7976931348623157e+308"},
{dbl(2.22507385850720138309e-308), "2.22507385850720138309e-308"}
}, false);
TestValidDataForType(FieldDescriptor::TYPE_FLOAT, {
{flt(0.1), "0.1"},
{flt(1.00000075e-36), "1.00000075e-36"},

@ -0,0 +1,135 @@
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.FieldMaskTooManyUnderscore.JsonOutput
Recommended.JsonInput.DurationHas3FractionalDigits.Validator
Recommended.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.JsonInput.DurationHas9FractionalDigits.Validator
Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator
Recommended.JsonInput.Int64FieldBeString.Validator
Recommended.JsonInput.MapFieldValueIsNull
Recommended.JsonInput.RepeatedFieldMessageElementIsNull
Recommended.JsonInput.RepeatedFieldPrimitiveElementIsNull
Recommended.JsonInput.StringEndsWithEscapeChar
Recommended.JsonInput.StringFieldSurrogateInWrongOrder
Recommended.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.JsonInput.StringFieldUnpairedLowSurrogate
Recommended.JsonInput.TimestampHas3FractionalDigits.Validator
Recommended.JsonInput.TimestampHas6FractionalDigits.Validator
Recommended.JsonInput.TimestampHas9FractionalDigits.Validator
Recommended.JsonInput.TimestampHasZeroFractionalDigit.Validator
Recommended.JsonInput.TimestampZeroNormalized.Validator
Recommended.JsonInput.Uint64FieldBeString.Validator
Required.DurationProtoInputTooLarge.JsonOutput
Required.DurationProtoInputTooSmall.JsonOutput
Required.JsonInput.Any.JsonOutput
Required.JsonInput.Any.ProtobufOutput
Required.JsonInput.AnyNested.JsonOutput
Required.JsonInput.AnyNested.ProtobufOutput
Required.JsonInput.AnyUnorderedTypeTag.JsonOutput
Required.JsonInput.AnyUnorderedTypeTag.ProtobufOutput
Required.JsonInput.AnyWithDuration.JsonOutput
Required.JsonInput.AnyWithDuration.ProtobufOutput
Required.JsonInput.AnyWithFieldMask.JsonOutput
Required.JsonInput.AnyWithFieldMask.ProtobufOutput
Required.JsonInput.AnyWithInt32ValueWrapper.JsonOutput
Required.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput
Required.JsonInput.AnyWithStruct.JsonOutput
Required.JsonInput.AnyWithStruct.ProtobufOutput
Required.JsonInput.AnyWithTimestamp.JsonOutput
Required.JsonInput.AnyWithTimestamp.ProtobufOutput
Required.JsonInput.AnyWithValueForInteger.JsonOutput
Required.JsonInput.AnyWithValueForInteger.ProtobufOutput
Required.JsonInput.AnyWithValueForJsonObject.JsonOutput
Required.JsonInput.AnyWithValueForJsonObject.ProtobufOutput
Required.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
Required.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput
Required.JsonInput.DoubleFieldMinPositiveValue.JsonOutput
Required.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput
Required.JsonInput.DoubleFieldNan.JsonOutput
Required.JsonInput.DurationMaxValue.JsonOutput
Required.JsonInput.DurationMaxValue.ProtobufOutput
Required.JsonInput.DurationMinValue.JsonOutput
Required.JsonInput.DurationMinValue.ProtobufOutput
Required.JsonInput.DurationRepeatedValue.JsonOutput
Required.JsonInput.DurationRepeatedValue.ProtobufOutput
Required.JsonInput.FieldMask.JsonOutput
Required.JsonInput.FieldMask.ProtobufOutput
Required.JsonInput.FloatFieldInfinity.JsonOutput
Required.JsonInput.FloatFieldNan.JsonOutput
Required.JsonInput.FloatFieldNegativeInfinity.JsonOutput
Required.JsonInput.FloatFieldTooLarge
Required.JsonInput.FloatFieldTooSmall
Required.JsonInput.OneofFieldDuplicate
Required.JsonInput.OptionalBoolWrapper.JsonOutput
Required.JsonInput.OptionalBoolWrapper.ProtobufOutput
Required.JsonInput.OptionalBytesWrapper.JsonOutput
Required.JsonInput.OptionalBytesWrapper.ProtobufOutput
Required.JsonInput.OptionalDoubleWrapper.JsonOutput
Required.JsonInput.OptionalDoubleWrapper.ProtobufOutput
Required.JsonInput.OptionalFloatWrapper.JsonOutput
Required.JsonInput.OptionalFloatWrapper.ProtobufOutput
Required.JsonInput.OptionalInt32Wrapper.JsonOutput
Required.JsonInput.OptionalInt32Wrapper.ProtobufOutput
Required.JsonInput.OptionalInt64Wrapper.JsonOutput
Required.JsonInput.OptionalInt64Wrapper.ProtobufOutput
Required.JsonInput.OptionalStringWrapper.JsonOutput
Required.JsonInput.OptionalStringWrapper.ProtobufOutput
Required.JsonInput.OptionalUint32Wrapper.JsonOutput
Required.JsonInput.OptionalUint32Wrapper.ProtobufOutput
Required.JsonInput.OptionalUint64Wrapper.JsonOutput
Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput
Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
Required.JsonInput.RepeatedBoolWrapper.JsonOutput
Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput
Required.JsonInput.RepeatedBytesWrapper.JsonOutput
Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput
Required.JsonInput.RepeatedDoubleWrapper.JsonOutput
Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput
Required.JsonInput.RepeatedFloatWrapper.JsonOutput
Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput
Required.JsonInput.RepeatedInt32Wrapper.JsonOutput
Required.JsonInput.RepeatedInt32Wrapper.ProtobufOutput
Required.JsonInput.RepeatedInt64Wrapper.JsonOutput
Required.JsonInput.RepeatedInt64Wrapper.ProtobufOutput
Required.JsonInput.RepeatedStringWrapper.JsonOutput
Required.JsonInput.RepeatedStringWrapper.ProtobufOutput
Required.JsonInput.RepeatedUint32Wrapper.JsonOutput
Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput
Required.JsonInput.RepeatedUint64Wrapper.JsonOutput
Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput
Required.JsonInput.StringFieldSurrogatePair.JsonOutput
Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput
Required.JsonInput.Struct.JsonOutput
Required.JsonInput.Struct.ProtobufOutput
Required.JsonInput.TimestampMaxValue.JsonOutput
Required.JsonInput.TimestampMaxValue.ProtobufOutput
Required.JsonInput.TimestampMinValue.JsonOutput
Required.JsonInput.TimestampMinValue.ProtobufOutput
Required.JsonInput.TimestampRepeatedValue.JsonOutput
Required.JsonInput.TimestampRepeatedValue.ProtobufOutput
Required.JsonInput.TimestampWithNegativeOffset.JsonOutput
Required.JsonInput.TimestampWithNegativeOffset.ProtobufOutput
Required.JsonInput.TimestampWithPositiveOffset.JsonOutput
Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput
Required.JsonInput.ValueAcceptBool.JsonOutput
Required.JsonInput.ValueAcceptBool.ProtobufOutput
Required.JsonInput.ValueAcceptFloat.JsonOutput
Required.JsonInput.ValueAcceptFloat.ProtobufOutput
Required.JsonInput.ValueAcceptInteger.JsonOutput
Required.JsonInput.ValueAcceptInteger.ProtobufOutput
Required.JsonInput.ValueAcceptList.JsonOutput
Required.JsonInput.ValueAcceptList.ProtobufOutput
Required.JsonInput.ValueAcceptNull.JsonOutput
Required.JsonInput.ValueAcceptNull.ProtobufOutput
Required.JsonInput.ValueAcceptObject.JsonOutput
Required.JsonInput.ValueAcceptObject.ProtobufOutput
Required.JsonInput.ValueAcceptString.JsonOutput
Required.JsonInput.ValueAcceptString.ProtobufOutput
Required.Protobuf3Input.DoubleFieldNormalizeQuietNan.JsonOutput
Required.Protobuf3Input.DoubleFieldNormalizeSignalingNan.JsonOutput
Required.Protobuf3Input.FloatFieldNormalizeQuietNan.JsonOutput
Required.Protobuf3Input.FloatFieldNormalizeSignalingNan.JsonOutput
Required.Protobuf3Input.ValidDataRepeated.FLOAT.JsonOutput
Required.TimestampProtoInputTooLarge.JsonOutput
Required.TimestampProtoInputTooSmall.JsonOutput

@ -80,6 +80,7 @@ def GenerateUnittestProtos():
generate_proto("../src/google/protobuf/any_test.proto", False)
generate_proto("../src/google/protobuf/map_unittest.proto", False)
generate_proto("../src/google/protobuf/test_messages_proto3.proto", False)
generate_proto("../src/google/protobuf/test_messages_proto2.proto", False)
generate_proto("../src/google/protobuf/unittest_arena.proto", False)
generate_proto("../src/google/protobuf/unittest_no_arena.proto", False)
generate_proto("../src/google/protobuf/unittest_no_arena_import.proto", False)

@ -0,0 +1,17 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/any.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Any" do
optional :type_url, :string, 1
optional :value, :bytes, 2
end
end
module Google
module Protobuf
Any = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Any").msgclass
end
end

@ -0,0 +1,39 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/api.proto
require 'google/protobuf'
require 'google/protobuf/source_context_pb'
require 'google/protobuf/type_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Api" do
optional :name, :string, 1
repeated :methods, :message, 2, "google.protobuf.Method"
repeated :options, :message, 3, "google.protobuf.Option"
optional :version, :string, 4
optional :source_context, :message, 5, "google.protobuf.SourceContext"
repeated :mixins, :message, 6, "google.protobuf.Mixin"
optional :syntax, :enum, 7, "google.protobuf.Syntax"
end
add_message "google.protobuf.Method" do
optional :name, :string, 1
optional :request_type_url, :string, 2
optional :request_streaming, :bool, 3
optional :response_type_url, :string, 4
optional :response_streaming, :bool, 5
repeated :options, :message, 6, "google.protobuf.Option"
optional :syntax, :enum, 7, "google.protobuf.Syntax"
end
add_message "google.protobuf.Mixin" do
optional :name, :string, 1
optional :root, :string, 2
end
end
module Google
module Protobuf
Api = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Api").msgclass
Method = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Method").msgclass
Mixin = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Mixin").msgclass
end
end

@ -0,0 +1,17 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/duration.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Duration" do
optional :seconds, :int64, 1
optional :nanos, :int32, 2
end
end
module Google
module Protobuf
Duration = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Duration").msgclass
end
end

@ -0,0 +1,15 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/empty.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Empty" do
end
end
module Google
module Protobuf
Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass
end
end

@ -0,0 +1,16 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/field_mask.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.FieldMask" do
repeated :paths, :string, 1
end
end
module Google
module Protobuf
FieldMask = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldMask").msgclass
end
end

@ -0,0 +1,16 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/source_context.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.SourceContext" do
optional :file_name, :string, 1
end
end
module Google
module Protobuf
SourceContext = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceContext").msgclass
end
end

@ -0,0 +1,35 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/struct.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Struct" do
map :fields, :string, :message, 1, "google.protobuf.Value"
end
add_message "google.protobuf.Value" do
oneof :kind do
optional :null_value, :enum, 1, "google.protobuf.NullValue"
optional :number_value, :double, 2
optional :string_value, :string, 3
optional :bool_value, :bool, 4
optional :struct_value, :message, 5, "google.protobuf.Struct"
optional :list_value, :message, 6, "google.protobuf.ListValue"
end
end
add_message "google.protobuf.ListValue" do
repeated :values, :message, 1, "google.protobuf.Value"
end
add_enum "google.protobuf.NullValue" do
value :NULL_VALUE, 0
end
end
module Google
module Protobuf
Struct = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Struct").msgclass
Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Value").msgclass
ListValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ListValue").msgclass
NullValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.NullValue").enummodule
end
end

@ -0,0 +1,17 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/timestamp.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Timestamp" do
optional :seconds, :int64, 1
optional :nanos, :int32, 2
end
end
module Google
module Protobuf
Timestamp = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Timestamp").msgclass
end
end

@ -0,0 +1,89 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
require 'google/protobuf'
require 'google/protobuf/any_pb'
require 'google/protobuf/source_context_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.Type" do
optional :name, :string, 1
repeated :fields, :message, 2, "google.protobuf.Field"
repeated :oneofs, :string, 3
repeated :options, :message, 4, "google.protobuf.Option"
optional :source_context, :message, 5, "google.protobuf.SourceContext"
optional :syntax, :enum, 6, "google.protobuf.Syntax"
end
add_message "google.protobuf.Field" do
optional :kind, :enum, 1, "google.protobuf.Field.Kind"
optional :cardinality, :enum, 2, "google.protobuf.Field.Cardinality"
optional :number, :int32, 3
optional :name, :string, 4
optional :type_url, :string, 6
optional :oneof_index, :int32, 7
optional :packed, :bool, 8
repeated :options, :message, 9, "google.protobuf.Option"
optional :json_name, :string, 10
optional :default_value, :string, 11
end
add_enum "google.protobuf.Field.Kind" do
value :TYPE_UNKNOWN, 0
value :TYPE_DOUBLE, 1
value :TYPE_FLOAT, 2
value :TYPE_INT64, 3
value :TYPE_UINT64, 4
value :TYPE_INT32, 5
value :TYPE_FIXED64, 6
value :TYPE_FIXED32, 7
value :TYPE_BOOL, 8
value :TYPE_STRING, 9
value :TYPE_GROUP, 10
value :TYPE_MESSAGE, 11
value :TYPE_BYTES, 12
value :TYPE_UINT32, 13
value :TYPE_ENUM, 14
value :TYPE_SFIXED32, 15
value :TYPE_SFIXED64, 16
value :TYPE_SINT32, 17
value :TYPE_SINT64, 18
end
add_enum "google.protobuf.Field.Cardinality" do
value :CARDINALITY_UNKNOWN, 0
value :CARDINALITY_OPTIONAL, 1
value :CARDINALITY_REQUIRED, 2
value :CARDINALITY_REPEATED, 3
end
add_message "google.protobuf.Enum" do
optional :name, :string, 1
repeated :enumvalue, :message, 2, "google.protobuf.EnumValue"
repeated :options, :message, 3, "google.protobuf.Option"
optional :source_context, :message, 4, "google.protobuf.SourceContext"
optional :syntax, :enum, 5, "google.protobuf.Syntax"
end
add_message "google.protobuf.EnumValue" do
optional :name, :string, 1
optional :number, :int32, 2
repeated :options, :message, 3, "google.protobuf.Option"
end
add_message "google.protobuf.Option" do
optional :name, :string, 1
optional :value, :message, 2, "google.protobuf.Any"
end
add_enum "google.protobuf.Syntax" do
value :SYNTAX_PROTO2, 0
value :SYNTAX_PROTO3, 1
end
end
module Google
module Protobuf
Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Type").msgclass
Field = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field").msgclass
Field::Kind = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Kind").enummodule
Field::Cardinality = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Cardinality").enummodule
Enum = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Enum").msgclass
EnumValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValue").msgclass
Option = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Option").msgclass
Syntax = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Syntax").enummodule
end
end

@ -0,0 +1,48 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.protobuf.DoubleValue" do
optional :value, :double, 1
end
add_message "google.protobuf.FloatValue" do
optional :value, :float, 1
end
add_message "google.protobuf.Int64Value" do
optional :value, :int64, 1
end
add_message "google.protobuf.UInt64Value" do
optional :value, :uint64, 1
end
add_message "google.protobuf.Int32Value" do
optional :value, :int32, 1
end
add_message "google.protobuf.UInt32Value" do
optional :value, :uint32, 1
end
add_message "google.protobuf.BoolValue" do
optional :value, :bool, 1
end
add_message "google.protobuf.StringValue" do
optional :value, :string, 1
end
add_message "google.protobuf.BytesValue" do
optional :value, :bytes, 1
end
end
module Google
module Protobuf
DoubleValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DoubleValue").msgclass
FloatValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FloatValue").msgclass
Int64Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int64Value").msgclass
UInt64Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt64Value").msgclass
Int32Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int32Value").msgclass
UInt32Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt32Value").msgclass
BoolValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BoolValue").msgclass
StringValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.StringValue").msgclass
BytesValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BytesValue").msgclass
end
end

@ -0,0 +1,74 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tests/generated_code.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "a.b.c.TestMessage" do
optional :optional_int32, :int32, 1
optional :optional_int64, :int64, 2
optional :optional_uint32, :uint32, 3
optional :optional_uint64, :uint64, 4
optional :optional_bool, :bool, 5
optional :optional_double, :double, 6
optional :optional_float, :float, 7
optional :optional_string, :string, 8
optional :optional_bytes, :bytes, 9
optional :optional_enum, :enum, 10, "a.b.c.TestEnum"
optional :optional_msg, :message, 11, "a.b.c.TestMessage"
repeated :repeated_int32, :int32, 21
repeated :repeated_int64, :int64, 22
repeated :repeated_uint32, :uint32, 23
repeated :repeated_uint64, :uint64, 24
repeated :repeated_bool, :bool, 25
repeated :repeated_double, :double, 26
repeated :repeated_float, :float, 27
repeated :repeated_string, :string, 28
repeated :repeated_bytes, :bytes, 29
repeated :repeated_enum, :enum, 30, "a.b.c.TestEnum"
repeated :repeated_msg, :message, 31, "a.b.c.TestMessage"
map :map_int32_string, :int32, :string, 61
map :map_int64_string, :int64, :string, 62
map :map_uint32_string, :uint32, :string, 63
map :map_uint64_string, :uint64, :string, 64
map :map_bool_string, :bool, :string, 65
map :map_string_string, :string, :string, 66
map :map_string_msg, :string, :message, 67, "a.b.c.TestMessage"
map :map_string_enum, :string, :enum, 68, "a.b.c.TestEnum"
map :map_string_int32, :string, :int32, 69
map :map_string_bool, :string, :bool, 70
optional :nested_message, :message, 80, "a.b.c.TestMessage.NestedMessage"
oneof :my_oneof do
optional :oneof_int32, :int32, 41
optional :oneof_int64, :int64, 42
optional :oneof_uint32, :uint32, 43
optional :oneof_uint64, :uint64, 44
optional :oneof_bool, :bool, 45
optional :oneof_double, :double, 46
optional :oneof_float, :float, 47
optional :oneof_string, :string, 48
optional :oneof_bytes, :bytes, 49
optional :oneof_enum, :enum, 50, "a.b.c.TestEnum"
optional :oneof_msg, :message, 51, "a.b.c.TestMessage"
end
end
add_message "a.b.c.TestMessage.NestedMessage" do
optional :foo, :int32, 1
end
add_enum "a.b.c.TestEnum" do
value :Default, 0
value :A, 1
value :B, 2
value :C, 3
end
end
module A
module B
module C
TestMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("a.b.c.TestMessage").msgclass
TestMessage::NestedMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("a.b.c.TestMessage.NestedMessage").msgclass
TestEnum = Google::Protobuf::DescriptorPool.generated_pool.lookup("a.b.c.TestEnum").enummodule
end
end
end

@ -0,0 +1,13 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tests/test_import.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "foo_bar.TestImportedMessage" do
end
end
module FooBar
TestImportedMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("foo_bar.TestImportedMessage").msgclass
end
Loading…
Cancel
Save