editions: add some test protos for editions

I'll add the runtime implementations and tests in a followup change to
make it easier to review.

Change-Id: I2917e0d40a99e81799d89a66584a680ed7e8dbf7
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/561939
Auto-Submit: Lasse Folger <lassefolger@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Lasse Folger 2024-02-08 15:28:13 +01:00 committed by Gopher Robot
parent 2040e8671b
commit f387b036d8
7 changed files with 3937 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,152 @@
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
edition = "2023";
package goproto.protoc.protoeditions;
option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/protoeditions";
message FieldTestMessage {
bool optional_bool = 1;
Enum optional_enum = 2;
int32 optional_int32 = 3;
sint32 optional_sint32 = 4;
uint32 optional_uint32 = 5;
int64 optional_int64 = 6;
sint64 optional_sint64 = 7;
uint64 optional_uint64 = 8;
sfixed32 optional_sfixed32 = 9;
fixed32 optional_fixed32 = 10;
float optional_float = 11;
sfixed64 optional_sfixed64 = 12;
fixed64 optional_fixed64 = 13;
double optional_double = 14;
string optional_string = 15;
bytes optional_bytes = 16;
Message optional_Message = 17;
message OptionalGroup {
string optionalgroup = 19;
}
OptionalGroup optionalgroup = 18 [features.message_encoding = DELIMITED];
bool required_bool = 101 [features.field_presence = LEGACY_REQUIRED];
Enum required_enum = 102 [features.field_presence = LEGACY_REQUIRED];
int32 required_int32 = 103 [features.field_presence = LEGACY_REQUIRED];
sint32 required_sint32 = 104 [features.field_presence = LEGACY_REQUIRED];
uint32 required_uint32 = 105 [features.field_presence = LEGACY_REQUIRED];
int64 required_int64 = 106 [features.field_presence = LEGACY_REQUIRED];
sint64 required_sint64 = 107 [features.field_presence = LEGACY_REQUIRED];
uint64 required_uint64 = 108 [features.field_presence = LEGACY_REQUIRED];
sfixed32 required_sfixed32 = 109 [features.field_presence = LEGACY_REQUIRED];
fixed32 required_fixed32 = 110 [features.field_presence = LEGACY_REQUIRED];
float required_float = 111 [features.field_presence = LEGACY_REQUIRED];
sfixed64 required_sfixed64 = 112 [features.field_presence = LEGACY_REQUIRED];
fixed64 required_fixed64 = 113 [features.field_presence = LEGACY_REQUIRED];
double required_double = 114 [features.field_presence = LEGACY_REQUIRED];
string required_string = 115 [features.field_presence = LEGACY_REQUIRED];
bytes required_bytes = 116 [features.field_presence = LEGACY_REQUIRED];
Message required_Message = 117 [features.field_presence = LEGACY_REQUIRED];
message RequiredGroup {
string required_group = 119 [features.field_presence = LEGACY_REQUIRED];
}
RequiredGroup requiredgroup = 118 [
features.message_encoding = DELIMITED,
features.field_presence = LEGACY_REQUIRED
];
repeated bool repeated_bool = 201;
repeated Enum repeated_enum = 202;
repeated int32 repeated_int32 = 203;
repeated sint32 repeated_sint32 = 204;
repeated uint32 repeated_uint32 = 205;
repeated int64 repeated_int64 = 206;
repeated sint64 repeated_sint64 = 207;
repeated uint64 repeated_uint64 = 208;
repeated sfixed32 repeated_sfixed32 = 209;
repeated fixed32 repeated_fixed32 = 210;
repeated float repeated_float = 211;
repeated sfixed64 repeated_sfixed64 = 212;
repeated fixed64 repeated_fixed64 = 213;
repeated double repeated_double = 214;
repeated string repeated_string = 215;
repeated bytes repeated_bytes = 216;
repeated Message repeated_Message = 217;
message RepeatedGroup {
repeated string repeated_group = 219;
}
repeated RepeatedGroup repeatedgroup = 218
[features.message_encoding = DELIMITED];
bool default_bool = 301 [default = true];
Enum default_enum = 302 [default = ONE];
int32 default_int32 = 303 [default = 1];
sint32 default_sint32 = 304 [default = 1];
uint32 default_uint32 = 305 [default = 1];
int64 default_int64 = 306 [default = 1];
sint64 default_sint64 = 307 [default = 1];
uint64 default_uint64 = 308 [default = 1];
sfixed32 default_sfixed32 = 309 [default = 1];
fixed32 default_fixed32 = 310 [default = 1];
float default_float = 311 [default = 3.14];
sfixed64 default_sfixed64 = 312 [default = 1];
fixed64 default_fixed64 = 313 [default = 1];
double default_double = 314 [default = 3.1415];
string default_string = 315 [default = "hello,\"world!\"\n"];
bytes default_bytes = 316 [default = "hello,\xde\xad\xbe\xef"];
string default_zero_string = 350 [default = ""];
bytes default_zero_bytes = 351 [default = ""];
float default_float_neginf = 400 [default = -inf];
float default_float_posinf = 401 [default = inf];
float default_float_nan = 402 [default = nan];
double default_double_neginf = 403 [default = -inf];
double default_double_posinf = 404 [default = inf];
double default_double_nan = 405 [default = nan];
map<int32, int64> map_int32_int64 = 500;
map<string, Message> map_string_message = 501;
map<fixed64, Enum> map_fixed64_enum = 502;
message OneofGroup {
string oneof_group_field = 619;
}
oneof oneof_field {
bool oneof_bool = 601;
Enum oneof_enum = 602;
int32 oneof_int32 = 603;
sint32 oneof_sint32 = 604;
uint32 oneof_uint32 = 605;
int64 oneof_int64 = 606;
sint64 oneof_sint64 = 607;
uint64 oneof_uint64 = 608;
sfixed32 oneof_sfixed32 = 609;
fixed32 oneof_fixed32 = 610;
float oneof_float = 611;
sfixed64 oneof_sfixed64 = 612;
fixed64 oneof_fixed64 = 613;
double oneof_double = 614;
string oneof_string = 615;
bytes oneof_bytes = 616;
Message oneof_Message = 617;
OneofGroup oneofgroup = 618 [features.message_encoding = DELIMITED];
int32 oneof_largest_tag = 536870911;
}
oneof oneof_two {
int32 oneof_two_1 = 700;
int64 oneof_two_2 = 701;
}
enum Enum {
ZERO = 0;
ONE = 1;
}
message Message {}
reserved 10000, 10001;
reserved TEN_THOUSAND, TEN_THOUSAND_AND_ONE;
}

View File

@ -0,0 +1,278 @@
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: cmd/protoc-gen-go/testdata/protoeditions/nested_messages.proto
package protoeditions
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
type Layer1 struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
L2 *Layer1_Layer2 `protobuf:"bytes,1,opt,name=l2" json:"l2,omitempty"`
L3 *Layer1_Layer2_Layer3 `protobuf:"bytes,2,opt,name=l3" json:"l3,omitempty"`
}
func (x *Layer1) Reset() {
*x = Layer1{}
if protoimpl.UnsafeEnabled {
mi := &file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Layer1) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Layer1) ProtoMessage() {}
func (x *Layer1) ProtoReflect() protoreflect.Message {
mi := &file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Layer1.ProtoReflect.Descriptor instead.
func (*Layer1) Descriptor() ([]byte, []int) {
return file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescGZIP(), []int{0}
}
func (x *Layer1) GetL2() *Layer1_Layer2 {
if x != nil {
return x.L2
}
return nil
}
func (x *Layer1) GetL3() *Layer1_Layer2_Layer3 {
if x != nil {
return x.L3
}
return nil
}
type Layer1_Layer2 struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
L3 *Layer1_Layer2_Layer3 `protobuf:"bytes,1,opt,name=l3" json:"l3,omitempty"`
}
func (x *Layer1_Layer2) Reset() {
*x = Layer1_Layer2{}
if protoimpl.UnsafeEnabled {
mi := &file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Layer1_Layer2) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Layer1_Layer2) ProtoMessage() {}
func (x *Layer1_Layer2) ProtoReflect() protoreflect.Message {
mi := &file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Layer1_Layer2.ProtoReflect.Descriptor instead.
func (*Layer1_Layer2) Descriptor() ([]byte, []int) {
return file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescGZIP(), []int{0, 0}
}
func (x *Layer1_Layer2) GetL3() *Layer1_Layer2_Layer3 {
if x != nil {
return x.L3
}
return nil
}
type Layer1_Layer2_Layer3 struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Layer1_Layer2_Layer3) Reset() {
*x = Layer1_Layer2_Layer3{}
if protoimpl.UnsafeEnabled {
mi := &file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Layer1_Layer2_Layer3) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Layer1_Layer2_Layer3) ProtoMessage() {}
func (x *Layer1_Layer2_Layer3) ProtoReflect() protoreflect.Message {
mi := &file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Layer1_Layer2_Layer3.ProtoReflect.Descriptor instead.
func (*Layer1_Layer2_Layer3) Descriptor() ([]byte, []int) {
return file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescGZIP(), []int{0, 0, 0}
}
var File_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto protoreflect.FileDescriptor
var file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDesc = []byte{
0x0a, 0x3e, 0x63, 0x6d, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e,
0x2d, 0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x65,
0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x1c, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe1,
0x01, 0x0a, 0x06, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x31, 0x12, 0x3b, 0x0a, 0x02, 0x6c, 0x32, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x65, 0x64, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x31, 0x2e, 0x4c, 0x61, 0x79, 0x65,
0x72, 0x32, 0x52, 0x02, 0x6c, 0x32, 0x12, 0x42, 0x0a, 0x02, 0x6c, 0x33, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x32, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x31, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x32, 0x2e,
0x4c, 0x61, 0x79, 0x65, 0x72, 0x33, 0x52, 0x02, 0x6c, 0x33, 0x1a, 0x56, 0x0a, 0x06, 0x4c, 0x61,
0x79, 0x65, 0x72, 0x32, 0x12, 0x42, 0x0a, 0x02, 0x6c, 0x33, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x32, 0x2e, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
0x4c, 0x61, 0x79, 0x65, 0x72, 0x31, 0x2e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x32, 0x2e, 0x4c, 0x61,
0x79, 0x65, 0x72, 0x33, 0x52, 0x02, 0x6c, 0x33, 0x1a, 0x08, 0x0a, 0x06, 0x4c, 0x61, 0x79, 0x65,
0x72, 0x33, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c,
0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2f, 0x63, 0x6d, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d,
0x67, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var (
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescOnce sync.Once
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescData = file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDesc
)
func file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescGZIP() []byte {
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescOnce.Do(func() {
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescData = protoimpl.X.CompressGZIP(file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescData)
})
return file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDescData
}
var file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_goTypes = []interface{}{
(*Layer1)(nil), // 0: goproto.protoc.protoeditions.Layer1
(*Layer1_Layer2)(nil), // 1: goproto.protoc.protoeditions.Layer1.Layer2
(*Layer1_Layer2_Layer3)(nil), // 2: goproto.protoc.protoeditions.Layer1.Layer2.Layer3
}
var file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_depIdxs = []int32{
1, // 0: goproto.protoc.protoeditions.Layer1.l2:type_name -> goproto.protoc.protoeditions.Layer1.Layer2
2, // 1: goproto.protoc.protoeditions.Layer1.l3:type_name -> goproto.protoc.protoeditions.Layer1.Layer2.Layer3
2, // 2: goproto.protoc.protoeditions.Layer1.Layer2.l3:type_name -> goproto.protoc.protoeditions.Layer1.Layer2.Layer3
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_init() }
func file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_init() {
if File_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Layer1); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Layer1_Layer2); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Layer1_Layer2_Layer3); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_goTypes,
DependencyIndexes: file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_depIdxs,
MessageInfos: file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_msgTypes,
}.Build()
File_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto = out.File
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_rawDesc = nil
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_goTypes = nil
file_cmd_protoc_gen_go_testdata_protoeditions_nested_messages_proto_depIdxs = nil
}

View File

@ -0,0 +1,18 @@
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
edition = "2023";
package goproto.protoc.protoeditions;
option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/protoeditions";
message Layer1 {
message Layer2 {
message Layer3 {}
Layer3 l3 = 1;
}
Layer2 l2 = 1;
Layer2.Layer3 l3 = 2;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
edition = "2023";
package goproto.proto.testeditions;
option go_package = "google.golang.org/protobuf/internal/testprotos/testeditions";
message TestAllTypes {
message NestedMessage {
int32 a = 1;
TestAllTypes corecursive = 2;
}
enum NestedEnum {
FOO = 0;
BAR = 1;
BAZ = 2;
NEG = -1; // Intentionally negative.
}
int32 optional_int32 = 1;
int64 optional_int64 = 2;
uint32 optional_uint32 = 3;
uint64 optional_uint64 = 4;
sint32 optional_sint32 = 5;
sint64 optional_sint64 = 6;
fixed32 optional_fixed32 = 7;
fixed64 optional_fixed64 = 8;
sfixed32 optional_sfixed32 = 9;
sfixed64 optional_sfixed64 = 10;
float optional_float = 11;
double optional_double = 12;
bool optional_bool = 13;
string optional_string = 14;
bytes optional_bytes = 15;
NestedMessage optional_nested_message = 18;
NestedEnum optional_nested_enum = 21;
repeated int32 repeated_int32 = 31;
repeated int64 repeated_int64 = 32;
repeated uint32 repeated_uint32 = 33;
repeated uint64 repeated_uint64 = 34;
repeated sint32 repeated_sint32 = 35;
repeated sint64 repeated_sint64 = 36;
repeated fixed32 repeated_fixed32 = 37;
repeated fixed64 repeated_fixed64 = 38;
repeated sfixed32 repeated_sfixed32 = 39;
repeated sfixed64 repeated_sfixed64 = 40;
repeated float repeated_float = 41;
repeated double repeated_double = 42;
repeated bool repeated_bool = 43;
repeated string repeated_string = 44;
repeated bytes repeated_bytes = 45;
repeated NestedMessage repeated_nested_message = 48;
repeated NestedEnum repeated_nested_enum = 51;
map<int32, int32> map_int32_int32 = 56;
map<int64, int64> map_int64_int64 = 57;
map<uint32, uint32> map_uint32_uint32 = 58;
map<uint64, uint64> map_uint64_uint64 = 59;
map<sint32, sint32> map_sint32_sint32 = 60;
map<sint64, sint64> map_sint64_sint64 = 61;
map<fixed32, fixed32> map_fixed32_fixed32 = 62;
map<fixed64, fixed64> map_fixed64_fixed64 = 63;
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 64;
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 65;
map<int32, float> map_int32_float = 66;
map<int32, double> map_int32_double = 67;
map<bool, bool> map_bool_bool = 68;
map<string, string> map_string_string = 69;
map<string, bytes> map_string_bytes = 70;
map<string, NestedMessage> map_string_nested_message = 71;
map<string, NestedEnum> map_string_nested_enum = 73;
// Singular with defaults
int32 default_int32 = 81 [default = 81];
int64 default_int64 = 82 [default = 82];
uint32 default_uint32 = 83 [default = 83];
uint64 default_uint64 = 84 [default = 84];
sint32 default_sint32 = 85 [default = -85];
sint64 default_sint64 = 86 [default = 86];
fixed32 default_fixed32 = 87 [default = 87];
fixed64 default_fixed64 = 88 [default = 88];
sfixed32 default_sfixed32 = 89 [default = 89];
sfixed64 default_sfixed64 = 80 [default = -90];
float default_float = 91 [default = 91.5];
double default_double = 92 [default = 92e3];
bool default_bool = 93 [default = true];
string default_string = 94 [default = "hello"];
bytes default_bytes = 95 [default = "world"];
NestedEnum default_nested_enum = 96 [default = BAR];
oneof oneof_field {
uint32 oneof_uint32 = 111;
NestedMessage oneof_nested_message = 112;
string oneof_string = 113;
bytes oneof_bytes = 114;
bool oneof_bool = 115;
uint64 oneof_uint64 = 116;
float oneof_float = 117;
double oneof_double = 118;
NestedEnum oneof_enum = 119;
}
// A oneof with exactly one field.
oneof oneof_optional {
uint32 oneof_optional_uint32 = 120;
}
}

View File

@ -50,6 +50,49 @@ var (
]
}]
`)
protoEdition2023Message = mustParseFile(`
syntax: "editions"
edition: 2023
name: "proto_editions_2023_message.proto"
package: "test.editions2023"
options: {
features: {
field_presence: IMPLICIT
}
}
message_type: [{
name: "Message"
field: [
{name:"foo" number:1 type:TYPE_STRING},
{name:"bar" number:2 type:TYPE_STRING}
]
}]
`)
protoEdition2024Message = mustParseFile(`
syntax: "editions"
edition: 2024
name: "proto_editions_2024_message.proto"
package: "test.editions2024"
message_type: [{
name: "Message"
field: [
{
name:"foo" number:1
type:TYPE_STRING
},
{
name:"bar" number:2
type:TYPE_STRING
options: {
features: {
field_presence: IMPLICIT
utf8_validation: NONE
}
}
}
]
}]
`)
extendableMessage = mustParseFile(`
syntax: "proto2"
name: "extendable_message.proto"