aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/unittest.proto
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/unittest.proto')
-rw-r--r--src/google/protobuf/unittest.proto128
1 files changed, 127 insertions, 1 deletions
diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto
index 85fe6153..4af2b051 100644
--- a/src/google/protobuf/unittest.proto
+++ b/src/google/protobuf/unittest.proto
@@ -33,6 +33,8 @@
// Sanjay Ghemawat, Jeff Dean, and others.
//
// A proto file we will use for unit testing.
+//
+// LINT: ALLOW_GROUPS, LEGACY_NAMES
syntax = "proto2";
@@ -189,12 +191,20 @@ message NestedTestAllTypes {
message TestDeprecatedFields {
optional int32 deprecated_int32 = 1 [deprecated=true];
+ oneof oneof_fields {
+ int32 deprecated_int32_in_oneof = 2 [deprecated=true];
+ }
+}
+
+message TestDeprecatedMessage {
+ option deprecated = true;
}
// Define these after TestAllTypes to make sure the compiler can handle
// that.
message ForeignMessage {
optional int32 c = 1;
+ optional int32 d = 2;
}
enum ForeignEnum {
@@ -325,6 +335,17 @@ extend TestAllExtensions {
optional bytes oneof_bytes_extension = 114;
}
+message TestGroup {
+ optional group OptionalGroup = 16 {
+ optional int32 a = 17;
+ }
+ optional ForeignEnum optional_foreign_enum = 22;
+}
+
+message TestGroupExtension {
+ extensions 1 to max;
+}
+
message TestNestedExtension {
extend TestAllExtensions {
// Check for bug where string extensions declared in tested scope did not
@@ -334,6 +355,13 @@ message TestNestedExtension {
// underscores.
optional string nested_string_extension = 1003;
}
+
+ extend TestGroupExtension {
+ optional group OptionalGroup_extension = 16 {
+ optional int32 a = 17;
+ }
+ optional ForeignEnum optional_foreign_enum_extension = 22;
+ }
}
// We have separate messages for testing required fields because it's
@@ -392,6 +420,12 @@ message TestRequiredForeign {
optional int32 dummy = 3;
}
+message TestRequiredMessage {
+ optional TestRequired optional_message = 1;
+ repeated TestRequired repeated_message = 2;
+ required TestRequired required_message = 3;
+}
+
// Test that we can use NestedMessage from outside TestAllTypes.
message TestForeignNested {
optional TestAllTypes.NestedMessage foreign_nested = 1;
@@ -428,7 +462,14 @@ message TestRecursiveMessage {
// Test that mutual recursion works.
message TestMutualRecursionA {
+ message SubMessage {
+ optional TestMutualRecursionB b = 1;
+ }
optional TestMutualRecursionB bb = 1;
+ optional group SubGroup = 2 {
+ optional SubMessage sub_message = 3; // Needed because of bug in javatest
+ optional TestAllTypes not_in_this_scc = 4;
+ }
}
message TestMutualRecursionB {
@@ -436,6 +477,15 @@ message TestMutualRecursionB {
optional int32 optional_int32 = 2;
}
+message TestIsInitialized {
+ message SubMessage {
+ optional group SubGroup = 1 {
+ required int32 i = 2;
+ }
+ }
+ optional SubMessage sub_message = 1;
+}
+
// Test that groups have disjoint field numbers from their siblings and
// parents. This is NOT possible in proto1; only google.protobuf. When attempting
// to compile with proto1, this will emit an error; so we only include it
@@ -524,12 +574,30 @@ message TestFieldOrderings {
optional NestedMessage optional_nested_message = 200;
}
-
extend TestFieldOrderings {
optional string my_extension_string = 50;
optional int32 my_extension_int = 5;
}
+message TestExtensionOrderings1 {
+ extend TestFieldOrderings {
+ optional TestExtensionOrderings1 test_ext_orderings1 = 13;
+ }
+ optional string my_string = 1;
+}
+
+message TestExtensionOrderings2 {
+ extend TestFieldOrderings {
+ optional TestExtensionOrderings2 test_ext_orderings2 = 12;
+ }
+ message TestExtensionOrderings3 {
+ extend TestFieldOrderings {
+ optional TestExtensionOrderings3 test_ext_orderings3 = 14;
+ }
+ optional string my_string = 1;
+ }
+ optional string my_string = 1;
+}
message TestExtremeDefaultValues {
optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
@@ -696,6 +764,7 @@ message TestRequiredOneof {
}
}
+
// Test messages for packed fields
message TestPackedTypes {
@@ -876,3 +945,60 @@ service TestService {
message BarRequest {}
message BarResponse {}
+message TestJsonName {
+ optional int32 field_name1 = 1;
+ optional int32 fieldName2 = 2;
+ optional int32 FieldName3 = 3;
+ optional int32 _field_name4 = 4;
+ optional int32 FIELD_NAME5 = 5;
+ optional int32 field_name6 = 6 [json_name = "@type"];
+}
+
+message TestHugeFieldNumbers {
+ optional int32 optional_int32 = 536870000;
+ optional int32 fixed_32 = 536870001;
+ repeated int32 repeated_int32 = 536870002 [packed = false];
+ repeated int32 packed_int32 = 536870003 [packed = true];
+
+ optional ForeignEnum optional_enum = 536870004;
+ optional string optional_string = 536870005;
+ optional bytes optional_bytes = 536870006;
+ optional ForeignMessage optional_message = 536870007;
+
+ optional group OptionalGroup = 536870008 {
+ optional int32 group_a = 536870009;
+ }
+
+ map<string, string> string_string_map = 536870010;
+
+ oneof oneof_field {
+ uint32 oneof_uint32 = 536870011;
+ TestAllTypes oneof_test_all_types = 536870012;
+ string oneof_string = 536870013;
+ bytes oneof_bytes = 536870014;
+ }
+
+ extensions 536860000 to 536869999;
+}
+
+extend TestHugeFieldNumbers {
+ optional TestAllTypes test_all_types = 536860000;
+}
+
+message TestExtensionInsideTable {
+ optional int32 field1 = 1;
+ optional int32 field2 = 2;
+ optional int32 field3 = 3;
+ optional int32 field4 = 4;
+ extensions 5 to 5;
+ optional int32 field6 = 6;
+ optional int32 field7 = 7;
+ optional int32 field8 = 8;
+ optional int32 field9 = 9;
+ optional int32 field10 = 10;
+}
+
+extend TestExtensionInsideTable {
+ optional int32 test_extension_inside_table_extension = 5;
+}
+