|
|
@ -45,7 +45,7 @@ option java_generic_services = true; // auto-added |
|
|
|
option py_generic_services = true; // auto-added |
|
|
|
option py_generic_services = true; // auto-added |
|
|
|
option cc_enable_arenas = true; |
|
|
|
option cc_enable_arenas = true; |
|
|
|
|
|
|
|
|
|
|
|
import "unittest_import.proto"; |
|
|
|
import "csharp/protos/unittest_import.proto"; |
|
|
|
|
|
|
|
|
|
|
|
// We don't put this in a package within proto2 because we need to make sure |
|
|
|
// We don't put this in a package within proto2 because we need to make sure |
|
|
|
// that the generated code doesn't depend on being in the proto2 namespace. |
|
|
|
// that the generated code doesn't depend on being in the proto2 namespace. |
|
|
@ -99,7 +99,8 @@ message TestAllTypes { |
|
|
|
|
|
|
|
|
|
|
|
optional NestedMessage optional_nested_message = 18; |
|
|
|
optional NestedMessage optional_nested_message = 18; |
|
|
|
optional ForeignMessage optional_foreign_message = 19; |
|
|
|
optional ForeignMessage optional_foreign_message = 19; |
|
|
|
optional protobuf_unittest_import_proto2.ImportMessage optional_import_message = 20; |
|
|
|
optional protobuf_unittest_import_proto2.ImportMessage |
|
|
|
|
|
|
|
optional_import_message = 20; |
|
|
|
|
|
|
|
|
|
|
|
optional NestedEnum optional_nested_enum = 21; |
|
|
|
optional NestedEnum optional_nested_enum = 21; |
|
|
|
optional ForeignEnum optional_foreign_enum = 22; |
|
|
|
optional ForeignEnum optional_foreign_enum = 22; |
|
|
@ -137,7 +138,8 @@ message TestAllTypes { |
|
|
|
|
|
|
|
|
|
|
|
repeated NestedMessage repeated_nested_message = 48; |
|
|
|
repeated NestedMessage repeated_nested_message = 48; |
|
|
|
repeated ForeignMessage repeated_foreign_message = 49; |
|
|
|
repeated ForeignMessage repeated_foreign_message = 49; |
|
|
|
repeated protobuf_unittest_import_proto2.ImportMessage repeated_import_message = 50; |
|
|
|
repeated protobuf_unittest_import_proto2.ImportMessage |
|
|
|
|
|
|
|
repeated_import_message = 50; |
|
|
|
|
|
|
|
|
|
|
|
repeated NestedEnum repeated_nested_enum = 51; |
|
|
|
repeated NestedEnum repeated_nested_enum = 51; |
|
|
|
repeated ForeignEnum repeated_foreign_enum = 52; |
|
|
|
repeated ForeignEnum repeated_foreign_enum = 52; |
|
|
@ -167,10 +169,11 @@ message TestAllTypes { |
|
|
|
|
|
|
|
|
|
|
|
optional NestedEnum default_nested_enum = 81 [default = BAR]; |
|
|
|
optional NestedEnum default_nested_enum = 81 [default = BAR]; |
|
|
|
optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; |
|
|
|
optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; |
|
|
|
optional protobuf_unittest_import_proto2.ImportEnum |
|
|
|
optional protobuf_unittest_import_proto2.ImportEnum default_import_enum = 83 |
|
|
|
default_import_enum = 83 [default = IMPORT_BAR]; |
|
|
|
[default = IMPORT_BAR]; |
|
|
|
|
|
|
|
|
|
|
|
optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; |
|
|
|
optional string default_string_piece = 84 |
|
|
|
|
|
|
|
[ctype = STRING_PIECE, default = "abc"]; |
|
|
|
optional string default_cord = 85 [ctype = CORD, default = "123"]; |
|
|
|
optional string default_cord = 85 [ctype = CORD, default = "123"]; |
|
|
|
|
|
|
|
|
|
|
|
// For oneof test |
|
|
|
// For oneof test |
|
|
@ -260,8 +263,8 @@ extend TestAllExtensions { |
|
|
|
optional protobuf_unittest_import_proto2.PublicImportMessage |
|
|
|
optional protobuf_unittest_import_proto2.PublicImportMessage |
|
|
|
optional_public_import_message_extension = 26; |
|
|
|
optional_public_import_message_extension = 26; |
|
|
|
|
|
|
|
|
|
|
|
optional TestAllTypes.NestedMessage |
|
|
|
optional TestAllTypes.NestedMessage optional_lazy_message_extension = 27 |
|
|
|
optional_lazy_message_extension = 27 [lazy=true]; |
|
|
|
[lazy = true]; |
|
|
|
|
|
|
|
|
|
|
|
// Repeated |
|
|
|
// Repeated |
|
|
|
repeated int32 repeated_int32_extension = 31; |
|
|
|
repeated int32 repeated_int32_extension = 31; |
|
|
@ -297,8 +300,8 @@ extend TestAllExtensions { |
|
|
|
repeated string repeated_string_piece_extension = 54 [ctype = STRING_PIECE]; |
|
|
|
repeated string repeated_string_piece_extension = 54 [ctype = STRING_PIECE]; |
|
|
|
repeated string repeated_cord_extension = 55 [ctype = CORD]; |
|
|
|
repeated string repeated_cord_extension = 55 [ctype = CORD]; |
|
|
|
|
|
|
|
|
|
|
|
repeated TestAllTypes.NestedMessage |
|
|
|
repeated TestAllTypes.NestedMessage repeated_lazy_message_extension = 57 |
|
|
|
repeated_lazy_message_extension = 57 [lazy=true]; |
|
|
|
[lazy = true]; |
|
|
|
|
|
|
|
|
|
|
|
// Singular with defaults |
|
|
|
// Singular with defaults |
|
|
|
optional int32 default_int32_extension = 61 [default = 41]; |
|
|
|
optional int32 default_int32_extension = 61 [default = 41]; |
|
|
@ -317,15 +320,15 @@ extend TestAllExtensions { |
|
|
|
optional string default_string_extension = 74 [default = "hello"]; |
|
|
|
optional string default_string_extension = 74 [default = "hello"]; |
|
|
|
optional bytes default_bytes_extension = 75 [default = "world"]; |
|
|
|
optional bytes default_bytes_extension = 75 [default = "world"]; |
|
|
|
|
|
|
|
|
|
|
|
optional TestAllTypes.NestedEnum |
|
|
|
optional TestAllTypes.NestedEnum default_nested_enum_extension = 81 |
|
|
|
default_nested_enum_extension = 81 [default = BAR]; |
|
|
|
[default = BAR]; |
|
|
|
optional ForeignEnum |
|
|
|
optional ForeignEnum default_foreign_enum_extension = 82 |
|
|
|
default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; |
|
|
|
[default = FOREIGN_BAR]; |
|
|
|
optional protobuf_unittest_import_proto2.ImportEnum |
|
|
|
optional protobuf_unittest_import_proto2.ImportEnum |
|
|
|
default_import_enum_extension = 83 [default = IMPORT_BAR]; |
|
|
|
default_import_enum_extension = 83 [default = IMPORT_BAR]; |
|
|
|
|
|
|
|
|
|
|
|
optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, |
|
|
|
optional string default_string_piece_extension = 84 |
|
|
|
default="abc"]; |
|
|
|
[ctype = STRING_PIECE, default = "abc"]; |
|
|
|
optional string default_cord_extension = 85 [ctype = CORD, default = "123"]; |
|
|
|
optional string default_cord_extension = 85 [ctype = CORD, default = "123"]; |
|
|
|
|
|
|
|
|
|
|
|
// For oneof test |
|
|
|
// For oneof test |
|
|
@ -432,8 +435,7 @@ message TestForeignNested { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TestEmptyMessage is used to test unknown field support. |
|
|
|
// TestEmptyMessage is used to test unknown field support. |
|
|
|
message TestEmptyMessage { |
|
|
|
message TestEmptyMessage {} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Like above, but declare all field numbers as potential extensions. No |
|
|
|
// Like above, but declare all field numbers as potential extensions. No |
|
|
|
// actual extensions should ever be defined for this type. |
|
|
|
// actual extensions should ever be defined for this type. |
|
|
@ -487,13 +489,17 @@ message TestIsInitialized { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Test that groups have disjoint field numbers from their siblings and |
|
|
|
// Test that groups have disjoint field numbers from their siblings and |
|
|
|
// parents. This is NOT possible in proto1; only google.protobuf. When attempting |
|
|
|
// parents. This is NOT possible in proto1; only google.protobuf. When |
|
|
|
// to compile with proto1, this will emit an error; so we only include it |
|
|
|
// attempting to compile with proto1, this will emit an error; so we only |
|
|
|
// in protobuf_unittest_proto. |
|
|
|
// include it in protobuf_unittest_proto. |
|
|
|
message TestDupFieldNumber { // NO_PROTO1 |
|
|
|
message TestDupFieldNumber { // NO_PROTO1 |
|
|
|
optional int32 a = 1; // NO_PROTO1 |
|
|
|
optional int32 a = 1; // NO_PROTO1 |
|
|
|
optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 |
|
|
|
optional group Foo = 2 { |
|
|
|
optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 |
|
|
|
optional int32 a = 1; |
|
|
|
|
|
|
|
} // NO_PROTO1 |
|
|
|
|
|
|
|
optional group Bar = 3 { |
|
|
|
|
|
|
|
optional int32 a = 1; |
|
|
|
|
|
|
|
} // NO_PROTO1 |
|
|
|
} // NO_PROTO1 |
|
|
|
} // NO_PROTO1 |
|
|
|
|
|
|
|
|
|
|
|
// Additional messages for testing lazy fields. |
|
|
|
// Additional messages for testing lazy fields. |
|
|
@ -513,7 +519,6 @@ message TestNestedMessageHasBits { |
|
|
|
optional NestedMessage optional_nested_message = 1; |
|
|
|
optional NestedMessage optional_nested_message = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test an enum that has multiple values with the same number. |
|
|
|
// Test an enum that has multiple values with the same number. |
|
|
|
enum TestEnumWithDupValue { |
|
|
|
enum TestEnumWithDupValue { |
|
|
|
option allow_alias = true; |
|
|
|
option allow_alias = true; |
|
|
@ -554,7 +559,6 @@ message TestCamelCaseFieldNames { |
|
|
|
repeated string RepeatedCordField = 12 [ctype = CORD]; |
|
|
|
repeated string RepeatedCordField = 12 [ctype = CORD]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We list fields out of order, to ensure that we're using field number and not |
|
|
|
// We list fields out of order, to ensure that we're using field number and not |
|
|
|
// field index to determine serialization order. |
|
|
|
// field index to determine serialization order. |
|
|
|
message TestFieldOrderings { |
|
|
|
message TestFieldOrderings { |
|
|
@ -641,10 +645,9 @@ message TestExtremeDefaultValues { |
|
|
|
// String defaults containing the character '\000' |
|
|
|
// String defaults containing the character '\000' |
|
|
|
optional string string_with_zero = 23 [default = "hel\000lo"]; |
|
|
|
optional string string_with_zero = 23 [default = "hel\000lo"]; |
|
|
|
optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; |
|
|
|
optional bytes bytes_with_zero = 24 [default = "wor\000ld"]; |
|
|
|
optional string string_piece_with_zero = 25 [ctype=STRING_PIECE, |
|
|
|
optional string string_piece_with_zero = 25 |
|
|
|
default="ab\000c"]; |
|
|
|
[ctype = STRING_PIECE, default = "ab\000c"]; |
|
|
|
optional string cord_with_zero = 26 [ctype=CORD, |
|
|
|
optional string cord_with_zero = 26 [ctype = CORD, default = "12\0003"]; |
|
|
|
default="12\0003"]; |
|
|
|
|
|
|
|
optional string replacement_string = 27 [default = "${unknown}"]; |
|
|
|
optional string replacement_string = 27 [default = "${unknown}"]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -934,7 +937,6 @@ message TestCommentInjectionMessage { |
|
|
|
optional string a = 1 [default = "*/ <- Neither should this."]; |
|
|
|
optional string a = 1 [default = "*/ <- Neither should this."]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test that RPC services work. |
|
|
|
// Test that RPC services work. |
|
|
|
message FooRequest {} |
|
|
|
message FooRequest {} |
|
|
|
message FooResponse {} |
|
|
|
message FooResponse {} |
|
|
@ -947,7 +949,6 @@ service TestService { |
|
|
|
rpc Bar(BarRequest) returns (BarResponse); |
|
|
|
rpc Bar(BarRequest) returns (BarResponse); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message BarRequest {} |
|
|
|
message BarRequest {} |
|
|
|
message BarResponse {} |
|
|
|
message BarResponse {} |
|
|
|
|
|
|
|
|
|
|
@ -1110,4 +1111,4 @@ enum VeryLargeEnum { |
|
|
|
ENUM_LABEL_98 = 98; |
|
|
|
ENUM_LABEL_98 = 98; |
|
|
|
ENUM_LABEL_99 = 99; |
|
|
|
ENUM_LABEL_99 = 99; |
|
|
|
ENUM_LABEL_100 = 100; |
|
|
|
ENUM_LABEL_100 = 100; |
|
|
|
}; |
|
|
|
} |
|
|
|