| Index: third_party/protobuf/java/src/test/java/com/google/protobuf/map_for_proto2_test.proto
|
| diff --git a/third_party/protobuf/src/google/protobuf/unittest_mset.proto b/third_party/protobuf/java/src/test/java/com/google/protobuf/map_for_proto2_test.proto
|
| similarity index 56%
|
| copy from third_party/protobuf/src/google/protobuf/unittest_mset.proto
|
| copy to third_party/protobuf/java/src/test/java/com/google/protobuf/map_for_proto2_test.proto
|
| index 3497f09fa6d41b7b38357e7f2610dfb5c087d3e4..a9be5166d09f795325eb56b73e28de655bcbf15f 100644
|
| --- a/third_party/protobuf/src/google/protobuf/unittest_mset.proto
|
| +++ b/third_party/protobuf/java/src/test/java/com/google/protobuf/map_for_proto2_test.proto
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// https://developers.google.com/protocol-buffers/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,45 +28,47 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Author: kenton@google.com (Kenton Varda)
|
| -// Based on original Protocol Buffers design by
|
| -// Sanjay Ghemawat, Jeff Dean, and others.
|
| -//
|
| -// This file contains messages for testing message_set_wire_format.
|
| +syntax = "proto2";
|
|
|
| -package protobuf_unittest;
|
| +package map_for_proto2_test;
|
|
|
| -option optimize_for = SPEED;
|
| +option java_package = "map_test";
|
| +option java_outer_classname = "MapForProto2TestProto";
|
| +option java_generate_equals_and_hash = true;
|
|
|
| -// A message with message_set_wire_format.
|
| -message TestMessageSet {
|
| - option message_set_wire_format = true;
|
| - extensions 4 to max;
|
| -}
|
| +message TestMap {
|
| + message MessageValue {
|
| + optional int32 value = 1;
|
| + }
|
| + enum EnumValue {
|
| + FOO = 0;
|
| + BAR = 1;
|
| + BAZ = 2;
|
| + QUX = 3;
|
| + }
|
|
|
| -message TestMessageSetContainer {
|
| - optional TestMessageSet message_set = 1;
|
| -}
|
| + map<int32, int32> int32_to_int32_field = 1;
|
| + map<int32, string> int32_to_string_field = 2;
|
| + map<int32, bytes> int32_to_bytes_field = 3;
|
| + map<int32, EnumValue> int32_to_enum_field = 4;
|
| + map<int32, MessageValue> int32_to_message_field = 5;
|
| + map<string, int32> string_to_int32_field = 6;
|
|
|
| -message TestMessageSetExtension1 {
|
| - extend TestMessageSet {
|
| - optional TestMessageSetExtension1 message_set_extension = 1545008;
|
| + message MessageWithRequiredFields {
|
| + required int32 value = 1;
|
| }
|
| - optional int32 i = 15;
|
| + map<int32, MessageWithRequiredFields> required_message_map = 11;
|
| }
|
|
|
| -message TestMessageSetExtension2 {
|
| - extend TestMessageSet {
|
| - optional TestMessageSetExtension2 message_set_extension = 1547769;
|
| - }
|
| - optional string str = 25;
|
| +message TestUnknownEnumValue {
|
| + // Wire-compatible with TestMap.int32_to_enum_field so we can test the
|
| + // parsing behavior of TestMap regarding unknown enum values.
|
| + map<int32, int32> int32_to_int32_field = 4;
|
| }
|
|
|
| -// MessageSet wire format is equivalent to this.
|
| -message RawMessageSet {
|
| - repeated group Item = 1 {
|
| - required int32 type_id = 2;
|
| - required bytes message = 3;
|
| - }
|
| +// Test that the maps initialization code works correctly when the map field
|
| +// references the containing message.
|
| +message TestRecursiveMap {
|
| + optional int32 value = 1;
|
| + map<int32, TestRecursiveMap> recursive_map_field = 2;
|
| }
|
| -
|
|
|