Automated rollback of commit 0bcc8ef9f2.

PiperOrigin-RevId: 594312823
pull/15231/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 4c35408777
commit a83da510c4
  1. 24
      conformance/conformance.proto
  2. 11
      conformance/conformance_objc.m
  3. 13
      conformance/conformance_test.cc

@ -35,8 +35,8 @@ enum WireFormat {
UNSPECIFIED = 0; UNSPECIFIED = 0;
PROTOBUF = 1; PROTOBUF = 1;
JSON = 2; JSON = 2;
JSPB = 3; // Only used inside Google. Opensource testees just skip it.
TEXT_FORMAT = 4; TEXT_FORMAT = 4;
reserved 3;
} }
enum TestCategory { enum TestCategory {
@ -49,10 +49,12 @@ enum TestCategory {
// https://developers.google.com/protocol-buffers/docs/proto3#json_options // https://developers.google.com/protocol-buffers/docs/proto3#json_options
// for more detail. // for more detail.
JSON_IGNORE_UNKNOWN_PARSING_TEST = 3; JSON_IGNORE_UNKNOWN_PARSING_TEST = 3;
// Test jspb wire format. Only used inside Google. Opensource testees just
// skip it.
JSPB_TEST = 4;
// Test text format. For cpp, java and python, testees can already deal with // Test text format. For cpp, java and python, testees can already deal with
// this type. Testees of other languages can simply skip it. // this type. Testees of other languages can simply skip it.
TEXT_FORMAT_TEST = 5; TEXT_FORMAT_TEST = 5;
reserved 4;
} }
// The conformance runner will request a list of failures as the first request. // The conformance runner will request a list of failures as the first request.
@ -74,6 +76,8 @@ message ConformanceRequest {
oneof payload { oneof payload {
bytes protobuf_payload = 1; bytes protobuf_payload = 1;
string json_payload = 2; string json_payload = 2;
// Only used inside Google. Opensource testees just skip it.
string jspb_payload = 7;
string text_payload = 8; string text_payload = 8;
} }
@ -90,11 +94,12 @@ message ConformanceRequest {
// TestCategory for more information. // TestCategory for more information.
TestCategory test_category = 5; TestCategory test_category = 5;
// Specify details for how to encode jspb.
JspbEncodingConfig jspb_encoding_options = 6;
// This can be used in json and text format. If true, testee should print // This can be used in json and text format. If true, testee should print
// unknown fields instead of ignore. This feature is optional. // unknown fields instead of ignore. This feature is optional.
bool print_unknown_fields = 9; bool print_unknown_fields = 9;
reserved 6, 7;
} }
// Represents a single test case's output. // Represents a single test case's output.
@ -134,10 +139,19 @@ message ConformanceResponse {
// wasn't supported, like JSON input/output. // wasn't supported, like JSON input/output.
string skipped = 5; string skipped = 5;
// If the input was successfully parsed and the requested output was JSPB,
// serialize to JSPB and set it in this field. JSPB is only used inside
// Google. Opensource testees can just skip it.
string jspb_payload = 7;
// If the input was successfully parsed and the requested output was // If the input was successfully parsed and the requested output was
// TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field. // TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
string text_payload = 8; string text_payload = 8;
} }
}
reserved 7; // Encoding options for jspb format.
message JspbEncodingConfig {
// Encode the value field of Any as jspb array if true, otherwise binary.
bool use_jspb_array_any_format = 1;
} }

@ -78,6 +78,11 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
response.skipped = @"ObjC doesn't support parsing JSON"; response.skipped = @"ObjC doesn't support parsing JSON";
break; break;
case ConformanceRequest_Payload_OneOfCase_JspbPayload:
response.skipped = @"ConformanceRequest had a jspb_payload ConformanceRequest.payload;"
" those aren't supposed to happen with opensource.";
break;
case ConformanceRequest_Payload_OneOfCase_TextPayload: case ConformanceRequest_Payload_OneOfCase_TextPayload:
response.skipped = @"ObjC doesn't support parsing TextFormat"; response.skipped = @"ObjC doesn't support parsing TextFormat";
break; break;
@ -103,6 +108,12 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
response.skipped = @"ObjC doesn't support generating JSON"; response.skipped = @"ObjC doesn't support generating JSON";
break; break;
case ConformanceWireFormat_Jspb:
response.skipped =
@"ConformanceRequest had a requested_output_format of JSPB WireFormat; that"
" isn't supposed to happen with opensource.";
break;
case ConformanceWireFormat_TextFormat: case ConformanceWireFormat_TextFormat:
// ObjC only has partial objc generation, so don't attempt any tests that need // ObjC only has partial objc generation, so don't attempt any tests that need
// support. // support.

@ -115,6 +115,11 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting(
break; break;
} }
case conformance::JSPB: {
request_.set_jspb_payload(input);
break;
}
case conformance::TEXT_FORMAT: { case conformance::TEXT_FORMAT: {
request_.set_text_payload(input); request_.set_text_payload(input);
break; break;
@ -225,6 +230,9 @@ ConformanceRequest ConformanceTestSuite::TruncateRequest(
case ConformanceRequest::kTextPayload: case ConformanceRequest::kTextPayload:
TruncateDebugPayload(debug_request.mutable_text_payload()); TruncateDebugPayload(debug_request.mutable_text_payload());
break; break;
case ConformanceRequest::kJspbPayload:
TruncateDebugPayload(debug_request.mutable_jspb_payload());
break;
default: default:
// Do nothing. // Do nothing.
break; break;
@ -245,6 +253,9 @@ ConformanceResponse ConformanceTestSuite::TruncateResponse(
case ConformanceResponse::kTextPayload: case ConformanceResponse::kTextPayload:
TruncateDebugPayload(debug_response.mutable_text_payload()); TruncateDebugPayload(debug_response.mutable_text_payload());
break; break;
case ConformanceResponse::kJspbPayload:
TruncateDebugPayload(debug_response.mutable_jspb_payload());
break;
default: default:
// Do nothing. // Do nothing.
break; break;
@ -418,6 +429,8 @@ std::string ConformanceTestSuite::WireFormatToString(WireFormat wire_format) {
return "PROTOBUF"; return "PROTOBUF";
case conformance::JSON: case conformance::JSON:
return "JSON"; return "JSON";
case conformance::JSPB:
return "JSPB";
case conformance::TEXT_FORMAT: case conformance::TEXT_FORMAT:
return "TEXT_FORMAT"; return "TEXT_FORMAT";
case conformance::UNSPECIFIED: case conformance::UNSPECIFIED:

Loading…
Cancel
Save