Down-integrate internal changes to github. (#5566)
* Down-integrate internal changes to github.
* fix csharp conformance test
* add comments in conformance.proto for text format
* fix comments
* fix comments, re-generated csharp file
* fix comments, re-generated csharp file
diff --git a/conformance/conformance_cpp.cc b/conformance/conformance_cpp.cc
index a451ab0..ff70d5d 100644
--- a/conformance/conformance_cpp.cc
+++ b/conformance/conformance_cpp.cc
@@ -36,6 +36,7 @@
#include <google/protobuf/test_messages_proto3.pb.h>
#include <google/protobuf/test_messages_proto2.pb.h>
#include <google/protobuf/message.h>
+#include <google/protobuf/text_format.h>
#include <google/protobuf/util/json_util.h>
#include <google/protobuf/util/type_resolver_util.h>
@@ -45,14 +46,15 @@
using google::protobuf::DescriptorPool;
using google::protobuf::Message;
using google::protobuf::MessageFactory;
+using google::protobuf::TextFormat;
using google::protobuf::util::BinaryToJsonString;
using google::protobuf::util::JsonParseOptions;
using google::protobuf::util::JsonToBinaryString;
using google::protobuf::util::NewTypeResolverForDescriptorPool;
using google::protobuf::util::Status;
using google::protobuf::util::TypeResolver;
-using protobuf_test_messages::proto3::TestAllTypesProto3;
using protobuf_test_messages::proto2::TestAllTypesProto2;
+using protobuf_test_messages::proto3::TestAllTypesProto3;
using std::string;
static const char kTypeUrlPrefix[] = "type.googleapis.com";
@@ -163,6 +165,14 @@
break;
}
+ case ConformanceRequest::kTextPayload: {
+ if (!TextFormat::ParseFromString(request.text_payload(), test_message)) {
+ response->set_parse_error("Parse error");
+ return;
+ }
+ break;
+ }
+
case ConformanceRequest::PAYLOAD_NOT_SET:
GOOGLE_LOG(FATAL) << "Request didn't have payload.";
break;
@@ -203,6 +213,12 @@
break;
}
+ case conformance::TEXT_FORMAT: {
+ GOOGLE_CHECK(TextFormat::PrintToString(*test_message,
+ response->mutable_text_payload()));
+ break;
+ }
+
default:
GOOGLE_LOG(FATAL) << "Unknown output format: "
<< request.requested_output_format();