Internal Code Change

PiperOrigin-RevId: 519775744
pull/12337/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent d60af33f09
commit 0549e52188
  1. 6
      objectivec/Tests/unittest.proto
  2. 1
      src/google/protobuf/compiler/BUILD.bazel
  3. 6
      src/google/protobuf/compiler/cpp/unittest.inc
  4. 19
      src/google/protobuf/compiler/parser_unittest.cc
  5. 6
      src/google/protobuf/unittest.proto
  6. 6
      src/google/protobuf/unittest_lite.proto
  7. 9
      src/google/protobuf/unittest_mset_wire_format.proto

@ -1098,7 +1098,11 @@ message TestHugeFieldNumbers {
bytes oneof_bytes = 536870014;
}
extensions 536860000 to 536869999;
extensions 530000000 to 536869999 [declaration = {
number: 536860000
full_name: ".objc.protobuf.tests.test_all_types"
type: ".objc.protobuf.tests.TestAllTypes"
}];
}
extend TestHugeFieldNumbers {

@ -311,6 +311,7 @@ cc_test(
"//:protobuf",
"//src/google/protobuf:cc_test_protos",
"//src/google/protobuf:test_util2",
"//src/google/protobuf/compiler:retention",
"//src/google/protobuf/io",
"//src/google/protobuf/stubs",
"//src/google/protobuf/testing",

@ -70,6 +70,7 @@
#include "google/protobuf/arena.h"
#include "google/protobuf/compiler/cpp/test_bad_identifiers.pb.h"
#include "google/protobuf/compiler/importer.h"
#include "google/protobuf/compiler/retention.h"
#include "google/protobuf/compiler/scc.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"
@ -129,9 +130,10 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) {
// Test that descriptors are generated correctly by converting them to
// FileDescriptorProtos and comparing.
FileDescriptorProto generated_descriptor_proto, parsed_descriptor_proto;
FileDescriptorProto generated_descriptor_proto;
generated_descriptor->CopyTo(&generated_descriptor_proto);
parsed_descriptor->CopyTo(&parsed_descriptor_proto);
FileDescriptorProto parsed_descriptor_proto =
compiler::StripSourceRetentionOptions(*parsed_descriptor);
EXPECT_EQ(parsed_descriptor_proto.DebugString(),
generated_descriptor_proto.DebugString());

@ -50,6 +50,7 @@
#include "absl/memory/memory.h"
#include "absl/strings/str_join.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/retention.h"
#include "google/protobuf/test_util2.h"
#include "google/protobuf/unittest.pb.h"
#include "google/protobuf/unittest_custom_options.pb.h"
@ -2421,11 +2422,29 @@ void StripFieldTypeName(FileDescriptorProto* file_proto) {
}
}
void StripEmptyOptions(DescriptorProto& proto) {
for (auto& ext : *proto.mutable_extension_range()) {
if (ext.has_options() && ext.options().DebugString().empty()) {
ext.clear_options();
}
}
}
void StripEmptyOptions(FileDescriptorProto& file_proto) {
if (file_proto.message_type_size() == 0) {
return;
}
for (auto& msg : *file_proto.mutable_message_type()) {
StripEmptyOptions(msg);
}
}
TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) {
const FileDescriptor* original_file =
protobuf_unittest::TestAllTypes::descriptor()->file();
FileDescriptorProto expected;
original_file->CopyTo(&expected);
StripEmptyOptions(expected);
// Get the DebugString of the unittest.proto FileDecriptor, which includes
// all other descriptor types

@ -1134,7 +1134,11 @@ message TestHugeFieldNumbers {
bytes oneof_bytes = 536870014;
}
extensions 536860000 to 536869999;
extensions 536860000 to 536869999 [declaration = {
number: 536860000
full_name: ".protobuf_unittest.test_all_types"
type: ".protobuf_unittest.TestAllTypes"
}];
}
extend TestHugeFieldNumbers {

@ -455,7 +455,11 @@ message TestHugeFieldNumbersLite {
bytes oneof_bytes = 536870014;
}
extensions 536860000 to 536869999;
extensions 536860000 to 536869999 [declaration = {
number: 536860000
full_name: ".protobuf_unittest.test_all_types_lite"
type: ".protobuf_unittest.TestAllTypesLite"
}];
}
extend TestHugeFieldNumbersLite {

@ -46,7 +46,14 @@ option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
message TestMessageSet {
option message_set_wire_format = true;
extensions 4 to max;
extensions 4 to 529999999;
extensions 530000000 to max
[declaration = {
number: 1952731290,
full_name: ".protobuf_unittest_v1api.TestMessageSetExtension3.message_set_extension",
type: ".protobuf_unittest_v1api.TestMessageSetExtension3"
}];
}
message TestMessageSetWireFormatContainer {

Loading…
Cancel
Save