|
|
|
@ -496,7 +496,7 @@ TEST_F(FileDescriptorTest, Syntax) { |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
proto.set_syntax("editions"); |
|
|
|
|
proto.set_edition_enum(EDITION_2023); |
|
|
|
|
proto.set_edition(EDITION_2023); |
|
|
|
|
DescriptorPool pool; |
|
|
|
|
const FileDescriptor* file = pool.BuildFile(proto); |
|
|
|
|
ASSERT_TRUE(file != nullptr); |
|
|
|
@ -506,7 +506,7 @@ TEST_F(FileDescriptorTest, Syntax) { |
|
|
|
|
FileDescriptorProto other; |
|
|
|
|
file->CopyTo(&other); |
|
|
|
|
EXPECT_EQ("editions", other.syntax()); |
|
|
|
|
EXPECT_EQ(other.edition_enum(), EDITION_2023); |
|
|
|
|
EXPECT_EQ(other.edition(), EDITION_2023); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -534,7 +534,7 @@ TEST_F(FileDescriptorTest, CopyHeadingTo) { |
|
|
|
|
EXPECT_EQ(&other.options().features(), &FeatureSet::default_instance()); |
|
|
|
|
{ |
|
|
|
|
proto.set_syntax("editions"); |
|
|
|
|
proto.set_edition_enum(EDITION_2023); |
|
|
|
|
proto.set_edition(EDITION_2023); |
|
|
|
|
|
|
|
|
|
DescriptorPool pool; |
|
|
|
|
const FileDescriptor* file = pool.BuildFile(proto); |
|
|
|
@ -545,7 +545,7 @@ TEST_F(FileDescriptorTest, CopyHeadingTo) { |
|
|
|
|
EXPECT_EQ(other.name(), "foo.proto"); |
|
|
|
|
EXPECT_EQ(other.package(), "foo.bar.baz"); |
|
|
|
|
EXPECT_EQ(other.syntax(), "editions"); |
|
|
|
|
EXPECT_EQ(other.edition_enum(), EDITION_2023); |
|
|
|
|
EXPECT_EQ(other.edition(), EDITION_2023); |
|
|
|
|
EXPECT_EQ(other.options().java_package(), "foo.bar.baz"); |
|
|
|
|
EXPECT_TRUE(other.message_type().empty()); |
|
|
|
|
EXPECT_EQ(&other.options().features(), &FeatureSet::default_instance()); |
|
|
|
@ -7533,7 +7533,7 @@ TEST_F(FeaturesTest, Edition2023Defaults) { |
|
|
|
|
FileDescriptorProto file_proto = ParseTextOrDie(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
)pb"); |
|
|
|
|
|
|
|
|
|
BuildDescriptorMessagesInTestPool(); |
|
|
|
@ -7561,7 +7561,7 @@ TEST_F(FeaturesBaseTest, DefaultEdition2023Defaults) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
)pb"); |
|
|
|
|
ASSERT_NE(file, nullptr); |
|
|
|
@ -7584,7 +7584,7 @@ TEST_F(FeaturesTest, ClearsOptions) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { |
|
|
|
|
java_package: "bar" |
|
|
|
|
features { field_presence: IMPLICIT } |
|
|
|
@ -7609,7 +7609,7 @@ TEST_F(FeaturesTest, RestoresOptionsRoundTrip) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
java_package: "bar" |
|
|
|
@ -7756,7 +7756,7 @@ TEST_F(FeaturesTest, RestoresLabelRoundTrip) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -7786,7 +7786,7 @@ TEST_F(FeaturesTest, RestoresGroupRoundTrip) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
nested_type { |
|
|
|
@ -7820,7 +7820,7 @@ TEST_F(FeaturesTest, OnlyMessagesInheritGroupEncoding) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { message_encoding: DELIMITED } } |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -7848,10 +7848,9 @@ TEST_F(FeaturesTest, OnlyMessagesInheritGroupEncoding) { |
|
|
|
|
|
|
|
|
|
TEST_F(FeaturesTest, NoOptions) { |
|
|
|
|
BuildDescriptorMessagesInTestPool(); |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
const FileDescriptor* file = |
|
|
|
|
BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" syntax: "editions" edition: EDITION_2023 |
|
|
|
|
)pb"); |
|
|
|
|
EXPECT_EQ(&file->options(), &FileOptions::default_instance()); |
|
|
|
|
EXPECT_THAT(GetCoreFeatures(file), EqualsProto(R"pb( |
|
|
|
@ -7870,9 +7869,7 @@ TEST_F(FeaturesTest, InvalidEdition) { |
|
|
|
|
BuildDescriptorMessagesInTestPool(); |
|
|
|
|
BuildFileWithErrors( |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_1_TEST_ONLY |
|
|
|
|
name: "foo.proto" syntax: "editions" edition: EDITION_1_TEST_ONLY |
|
|
|
|
)pb", |
|
|
|
|
"foo.proto: foo.proto: EDITIONS: Edition 1_TEST_ONLY is earlier than the " |
|
|
|
|
"minimum supported edition 2023\n"); |
|
|
|
@ -7883,7 +7880,7 @@ TEST_F(FeaturesTest, FileFeatures) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { field_presence: IMPLICIT } } |
|
|
|
|
)pb"); |
|
|
|
|
EXPECT_THAT(file->options(), EqualsProto("")); |
|
|
|
@ -7905,7 +7902,7 @@ TEST_F(FeaturesTest, FileFeaturesExtension) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_99998_TEST_ONLY |
|
|
|
|
edition: EDITION_99998_TEST_ONLY |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { features { field_presence: IMPLICIT } } |
|
|
|
|
)pb"); |
|
|
|
@ -7929,7 +7926,7 @@ TEST_F(FeaturesTest, FileFeaturesExtensionOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_99998_TEST_ONLY |
|
|
|
|
edition: EDITION_99998_TEST_ONLY |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -7959,7 +7956,7 @@ TEST_F(FeaturesTest, MessageFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { name: "Foo" } |
|
|
|
|
)pb"); |
|
|
|
|
const Descriptor* message = file->message_type(0); |
|
|
|
@ -7981,7 +7978,7 @@ TEST_F(FeaturesTest, MessageFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { field_presence: IMPLICIT } } |
|
|
|
|
message_type { name: "Foo" } |
|
|
|
|
)pb"); |
|
|
|
@ -7996,7 +7993,7 @@ TEST_F(FeaturesTest, MessageFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8024,7 +8021,7 @@ TEST_F(FeaturesTest, NestedMessageFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8063,7 +8060,7 @@ TEST_F(FeaturesTest, FieldFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { name: "bar" number: 1 label: LABEL_REPEATED type: TYPE_INT64 } |
|
|
|
@ -8089,7 +8086,7 @@ TEST_F(FeaturesTest, FieldFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8120,7 +8117,7 @@ TEST_F(FeaturesTest, FieldFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8164,7 +8161,7 @@ TEST_F(FeaturesTest, OneofFieldFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8209,7 +8206,7 @@ TEST_F(FeaturesTest, OneofFieldFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8318,7 +8315,7 @@ TEST_F(FeaturesTest, RootExtensionFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8359,7 +8356,7 @@ TEST_F(FeaturesTest, MessageExtensionFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8407,7 +8404,7 @@ TEST_F(FeaturesTest, EnumFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
enum_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
value { name: "BAR" number: 0 } |
|
|
|
@ -8432,7 +8429,7 @@ TEST_F(FeaturesTest, EnumFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { enum_type: CLOSED } } |
|
|
|
|
enum_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -8450,7 +8447,7 @@ TEST_F(FeaturesTest, EnumFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8478,7 +8475,7 @@ TEST_F(FeaturesTest, NestedEnumFeatures) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8516,7 +8513,7 @@ TEST_F(FeaturesTest, EnumValueFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
enum_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
value { name: "BAR" number: 0 } |
|
|
|
@ -8541,7 +8538,7 @@ TEST_F(FeaturesTest, EnumValueFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { enum_type: CLOSED } } |
|
|
|
|
enum_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -8565,7 +8562,7 @@ TEST_F(FeaturesTest, EnumValueFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8603,7 +8600,7 @@ TEST_F(FeaturesTest, OneofFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -8635,7 +8632,7 @@ TEST_F(FeaturesTest, OneofFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { enum_type: CLOSED } } |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -8666,7 +8663,7 @@ TEST_F(FeaturesTest, OneofFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8710,7 +8707,7 @@ TEST_F(FeaturesTest, ExtensionRangeFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
extension_range { start: 1 end: 100 } |
|
|
|
@ -8736,7 +8733,7 @@ TEST_F(FeaturesTest, ExtensionRangeFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { enum_type: CLOSED } } |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -8761,7 +8758,7 @@ TEST_F(FeaturesTest, ExtensionRangeFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8800,7 +8797,7 @@ TEST_F(FeaturesTest, ServiceFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
service { name: "Foo" } |
|
|
|
|
)pb"); |
|
|
|
|
const ServiceDescriptor* service = file->service(0); |
|
|
|
@ -8822,7 +8819,7 @@ TEST_F(FeaturesTest, ServiceFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { features { enum_type: CLOSED } } |
|
|
|
|
service { name: "Foo" } |
|
|
|
|
)pb"); |
|
|
|
@ -8837,7 +8834,7 @@ TEST_F(FeaturesTest, ServiceFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -8864,7 +8861,7 @@ TEST_F(FeaturesTest, MethodFeaturesDefault) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { name: "EmptyMsg" } |
|
|
|
|
service { |
|
|
|
|
name: "Foo" |
|
|
|
@ -8891,7 +8888,7 @@ TEST_F(FeaturesTest, MethodFeaturesInherit) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
message_type { name: "EmptyMsg" } |
|
|
|
|
options { features { enum_type: CLOSED } } |
|
|
|
@ -8918,7 +8915,7 @@ TEST_F(FeaturesTest, MethodFeaturesOverride) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
message_type { name: "EmptyMsg" } |
|
|
|
|
options { |
|
|
|
@ -8962,7 +8959,7 @@ TEST_F(FeaturesTest, FieldFeatureHelpers) { |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
dependency: "google/protobuf/cpp_features.proto" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { name: "def" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING } |
|
|
|
@ -9073,7 +9070,7 @@ TEST_F(FeaturesTest, EnumFeatureHelpers) { |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
dependency: "google/protobuf/cpp_features.proto" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
enum_type { |
|
|
|
|
name: "FooOpen" |
|
|
|
|
value { name: "BAR" number: 0 } |
|
|
|
@ -9137,7 +9134,7 @@ TEST_F(FeaturesTest, MergeFeatureValidationFailed) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { features { field_presence: FIELD_PRESENCE_UNKNOWN } } |
|
|
|
|
)pb", |
|
|
|
@ -9166,7 +9163,7 @@ TEST_F(FeaturesTest, InvalidFieldPacked) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9190,7 +9187,7 @@ TEST_F(FeaturesTest, InvalidFieldImplicitDefault) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9213,7 +9210,7 @@ TEST_F(FeaturesTest, InvalidFieldImplicitOpen) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9241,7 +9238,7 @@ TEST_F(FeaturesTest, InvalidFieldRequiredExtension) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
extension_range { start: 1 end: 100 } |
|
|
|
@ -9264,7 +9261,7 @@ TEST_F(FeaturesTest, InvalidFieldImplicitExtension) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
extension_range { start: 1 end: 100 } |
|
|
|
@ -9287,7 +9284,7 @@ TEST_F(FeaturesTest, InvalidFieldMessageImplicit) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9310,7 +9307,7 @@ TEST_F(FeaturesTest, InvalidFieldRepeatedImplicit) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9360,7 +9357,7 @@ TEST_F(FeaturesTest, InvalidFieldOneofImplicit) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9383,7 +9380,7 @@ TEST_F(FeaturesTest, InvalidFieldRepeatedRequired) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9405,7 +9402,7 @@ TEST_F(FeaturesTest, InvalidFieldOneofRequired) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9428,7 +9425,7 @@ TEST_F(FeaturesTest, InvalidFieldNonRepeatedWithRepeatedEncoding) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9450,7 +9447,7 @@ TEST_F(FeaturesTest, InvalidFieldNonPackableWithPackedRepeatedEncoding) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9472,7 +9469,7 @@ TEST_F(FeaturesTest, InvalidFieldNonMessageWithMessageEncoding) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9523,7 +9520,7 @@ TEST_F(FeaturesTest, InvalidOpenEnumNonZeroFirstValue) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
enum_type { |
|
|
|
|
name: "Enum" |
|
|
|
|
value { name: "BAR" number: 1 } |
|
|
|
@ -9540,7 +9537,7 @@ TEST_F(FeaturesTest, ClosedEnumNonZeroFirstValue) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
enum_type { |
|
|
|
|
name: "Enum" |
|
|
|
|
value { name: "BAR" number: 9 } |
|
|
|
@ -9557,7 +9554,7 @@ TEST_F(FeaturesTest, CopyToIncludesFeatures) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
java_package: "pkg" |
|
|
|
@ -9598,7 +9595,7 @@ TEST_F(FeaturesTest, UninterpretedOptions) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { |
|
|
|
|
uninterpreted_option { |
|
|
|
|
name { name_part: "features" is_extension: false } |
|
|
|
@ -9625,7 +9622,7 @@ TEST_F(FeaturesTest, UninterpretedOptionsMerge) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
options { |
|
|
|
|
uninterpreted_option { |
|
|
|
|
name { name_part: "features" is_extension: false } |
|
|
|
@ -9663,7 +9660,7 @@ TEST_F(FeaturesTest, UninterpretedOptionsMergeExtension) { |
|
|
|
|
const FileDescriptor* file = BuildFile(R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
uninterpreted_option { |
|
|
|
@ -9731,7 +9728,7 @@ TEST_F(FeaturesTest, InvalidJsonUniquenessDefaultWarning) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9758,7 +9755,7 @@ TEST_F(FeaturesTest, InvalidJsonUniquenessDefaultError) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9785,7 +9782,7 @@ TEST_F(FeaturesTest, InvalidJsonUniquenessCustomError) { |
|
|
|
|
R"pb( |
|
|
|
|
name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9865,13 +9862,13 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
testing::Values( |
|
|
|
|
std::make_tuple("Empty", R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
)pb"), |
|
|
|
|
std::make_tuple( |
|
|
|
|
"FileFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
options { |
|
|
|
|
features { |
|
|
|
@ -9882,7 +9879,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
std::make_tuple("FieldFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9899,7 +9896,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
std::make_tuple("Required", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
field { |
|
|
|
@ -9916,7 +9913,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
std::make_tuple("Group", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
nested_type { |
|
|
|
@ -9943,7 +9940,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
std::make_tuple("MessageFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
options { |
|
|
|
@ -9955,7 +9952,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
"OneofFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -9979,7 +9976,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
"ExtensionRangeFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
message_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -9997,7 +9994,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
std::make_tuple("EnumFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
enum_type { |
|
|
|
|
name: "Foo" |
|
|
|
|
value { name: "BAR" number: 1 } |
|
|
|
@ -10008,7 +10005,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
"EnumValueFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
enum_type { |
|
|
|
|
name: "Foo" |
|
|
|
@ -10028,7 +10025,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
"ServiceFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
service { |
|
|
|
|
name: "FooService" |
|
|
|
@ -10043,7 +10040,7 @@ INSTANTIATE_TEST_SUITE_P( |
|
|
|
|
"MethodFeature", |
|
|
|
|
R"pb(name: "foo.proto" |
|
|
|
|
syntax: "editions" |
|
|
|
|
edition_enum: EDITION_2023 |
|
|
|
|
edition: EDITION_2023 |
|
|
|
|
dependency: "google/protobuf/unittest_features.proto" |
|
|
|
|
message_type { name: "EmptyMessage" } |
|
|
|
|
service { |
|
|
|
|