From 9de4bdab241c9e27a402c790951b8c9ac26a71a7 Mon Sep 17 00:00:00 2001 From: Ezequiel Raynaudo Date: Thu, 14 Mar 2024 09:12:30 -0300 Subject: [PATCH] Fix tests attempt --- Makefile | 1 + test/testdata/Makefile | 30 +++ test/testdata/animal.go | 84 +++++++ test/testdata/testdata.pb.go | 433 +++++++++++++++++++++++++++++++++++ test/testdata/testdata.proto | 47 ++++ 5 files changed, 595 insertions(+) create mode 100644 test/testdata/Makefile create mode 100644 test/testdata/animal.go create mode 100644 test/testdata/testdata.pb.go create mode 100644 test/testdata/testdata.proto diff --git a/Makefile b/Makefile index b4bdcddb..379b41a3 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,7 @@ regenerate: install make -C test/issue620 regenerate make -C test/protobuffer regenerate make -C test/issue630 regenerate + make -C test/testdata regenerate make gofmt diff --git a/test/testdata/Makefile b/test/testdata/Makefile new file mode 100644 index 00000000..addf2fb7 --- /dev/null +++ b/test/testdata/Makefile @@ -0,0 +1,30 @@ +# Protocol Buffers for Go with Gadgets +# +# Copyright (c) 2013, The GoGo Authors. All rights reserved. +# http://github.com/cosmos/gogoproto +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +regenerate: + cd .. && (protoc --proto_path=../:../protobuf/:. --gogo_out=Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any:. testdata/testdata.proto) \ No newline at end of file diff --git a/test/testdata/animal.go b/test/testdata/animal.go new file mode 100644 index 00000000..82bab2db --- /dev/null +++ b/test/testdata/animal.go @@ -0,0 +1,84 @@ +package testdata + +// nolint + +import ( + "fmt" + "github.com/cosmos/gogoproto/proto" + types "github.com/cosmos/gogoproto/types/any" +) + +type Animal interface { + proto.Message + + Greet() string +} + +type Cartoon interface { + proto.Message + + Identify() string +} + +func (c *Cat) Greet() string { + return fmt.Sprintf("Meow, my name is %s", c.Moniker) +} + +func (c *Bird) Identify() string { + return "This is Tweety." +} + +func (d Dog) Greet() string { + return fmt.Sprintf("Roof, my name is %s", d.Name) +} + +var _ types.UnpackInterfacesMessage = HasAnimal{} + +func (m HasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var animal Animal + return unpacker.UnpackAny(m.Animal, &animal) +} + +type HasAnimalI interface { + TheAnimal() Animal +} + +var _ HasAnimalI = &HasAnimal{} + +func (m HasAnimal) TheAnimal() Animal { + return m.Animal.GetCachedValue().(Animal) +} + +type HasHasAnimalI interface { + TheHasAnimal() HasAnimalI +} + +var _ HasHasAnimalI = &HasHasAnimal{} + +func (m HasHasAnimal) TheHasAnimal() HasAnimalI { + return m.HasAnimal.GetCachedValue().(HasAnimalI) +} + +var _ types.UnpackInterfacesMessage = HasHasAnimal{} + +func (m HasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var animal HasAnimalI + return unpacker.UnpackAny(m.HasAnimal, &animal) +} + +type HasHasHasAnimalI interface { + TheHasHasAnimal() HasHasAnimalI +} + +var _ HasHasAnimalI = &HasHasAnimal{} + +func (m HasHasHasAnimal) TheHasHasAnimal() HasHasAnimalI { + return m.HasHasAnimal.GetCachedValue().(HasHasAnimalI) +} + +var _ types.UnpackInterfacesMessage = HasHasHasAnimal{} + +func (m HasHasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var animal HasHasAnimalI + return unpacker.UnpackAny(m.HasHasAnimal, &animal) +} diff --git a/test/testdata/testdata.pb.go b/test/testdata/testdata.pb.go new file mode 100644 index 00000000..b2398225 --- /dev/null +++ b/test/testdata/testdata.pb.go @@ -0,0 +1,433 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: testdata/testdata.proto + +package testdata + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + any "github.com/cosmos/gogoproto/types/any" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Dog struct { + Size_ string `protobuf:"bytes,1,opt,name=size,proto3" json:"size,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Dog) Reset() { *m = Dog{} } +func (m *Dog) String() string { return proto.CompactTextString(m) } +func (*Dog) ProtoMessage() {} +func (*Dog) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{0} +} +func (m *Dog) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Dog.Unmarshal(m, b) +} +func (m *Dog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Dog.Marshal(b, m, deterministic) +} +func (m *Dog) XXX_Merge(src proto.Message) { + xxx_messageInfo_Dog.Merge(m, src) +} +func (m *Dog) XXX_Size() int { + return xxx_messageInfo_Dog.Size(m) +} +func (m *Dog) XXX_DiscardUnknown() { + xxx_messageInfo_Dog.DiscardUnknown(m) +} + +var xxx_messageInfo_Dog proto.InternalMessageInfo + +func (m *Dog) GetSize_() string { + if m != nil { + return m.Size_ + } + return "" +} + +func (m *Dog) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type Cat struct { + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + Lives int32 `protobuf:"varint,2,opt,name=lives,proto3" json:"lives,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cat) Reset() { *m = Cat{} } +func (m *Cat) String() string { return proto.CompactTextString(m) } +func (*Cat) ProtoMessage() {} +func (*Cat) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{1} +} +func (m *Cat) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Cat.Unmarshal(m, b) +} +func (m *Cat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Cat.Marshal(b, m, deterministic) +} +func (m *Cat) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cat.Merge(m, src) +} +func (m *Cat) XXX_Size() int { + return xxx_messageInfo_Cat.Size(m) +} +func (m *Cat) XXX_DiscardUnknown() { + xxx_messageInfo_Cat.DiscardUnknown(m) +} + +var xxx_messageInfo_Cat proto.InternalMessageInfo + +func (m *Cat) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Cat) GetLives() int32 { + if m != nil { + return m.Lives + } + return 0 +} + +type Bird struct { + Species string `protobuf:"bytes,1,opt,name=species,proto3" json:"species,omitempty"` + Color int32 `protobuf:"varint,2,opt,name=color,proto3" json:"color,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Bird) Reset() { *m = Bird{} } +func (m *Bird) String() string { return proto.CompactTextString(m) } +func (*Bird) ProtoMessage() {} +func (*Bird) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{2} +} +func (m *Bird) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Bird.Unmarshal(m, b) +} +func (m *Bird) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Bird.Marshal(b, m, deterministic) +} +func (m *Bird) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bird.Merge(m, src) +} +func (m *Bird) XXX_Size() int { + return xxx_messageInfo_Bird.Size(m) +} +func (m *Bird) XXX_DiscardUnknown() { + xxx_messageInfo_Bird.DiscardUnknown(m) +} + +var xxx_messageInfo_Bird proto.InternalMessageInfo + +func (m *Bird) GetSpecies() string { + if m != nil { + return m.Species + } + return "" +} + +func (m *Bird) GetColor() int32 { + if m != nil { + return m.Color + } + return 0 +} + +type HasAnimal struct { + Animal *any.Any `protobuf:"bytes,1,opt,name=animal,proto3" json:"animal,omitempty"` + X int64 `protobuf:"varint,2,opt,name=x,proto3" json:"x,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HasAnimal) Reset() { *m = HasAnimal{} } +func (m *HasAnimal) String() string { return proto.CompactTextString(m) } +func (*HasAnimal) ProtoMessage() {} +func (*HasAnimal) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{3} +} +func (m *HasAnimal) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HasAnimal.Unmarshal(m, b) +} +func (m *HasAnimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HasAnimal.Marshal(b, m, deterministic) +} +func (m *HasAnimal) XXX_Merge(src proto.Message) { + xxx_messageInfo_HasAnimal.Merge(m, src) +} +func (m *HasAnimal) XXX_Size() int { + return xxx_messageInfo_HasAnimal.Size(m) +} +func (m *HasAnimal) XXX_DiscardUnknown() { + xxx_messageInfo_HasAnimal.DiscardUnknown(m) +} + +var xxx_messageInfo_HasAnimal proto.InternalMessageInfo + +func (m *HasAnimal) GetAnimal() *any.Any { + if m != nil { + return m.Animal + } + return nil +} + +func (m *HasAnimal) GetX() int64 { + if m != nil { + return m.X + } + return 0 +} + +type HasHasAnimal struct { + HasAnimal *any.Any `protobuf:"bytes,1,opt,name=has_animal,json=hasAnimal,proto3" json:"has_animal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HasHasAnimal) Reset() { *m = HasHasAnimal{} } +func (m *HasHasAnimal) String() string { return proto.CompactTextString(m) } +func (*HasHasAnimal) ProtoMessage() {} +func (*HasHasAnimal) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{4} +} +func (m *HasHasAnimal) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HasHasAnimal.Unmarshal(m, b) +} +func (m *HasHasAnimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HasHasAnimal.Marshal(b, m, deterministic) +} +func (m *HasHasAnimal) XXX_Merge(src proto.Message) { + xxx_messageInfo_HasHasAnimal.Merge(m, src) +} +func (m *HasHasAnimal) XXX_Size() int { + return xxx_messageInfo_HasHasAnimal.Size(m) +} +func (m *HasHasAnimal) XXX_DiscardUnknown() { + xxx_messageInfo_HasHasAnimal.DiscardUnknown(m) +} + +var xxx_messageInfo_HasHasAnimal proto.InternalMessageInfo + +func (m *HasHasAnimal) GetHasAnimal() *any.Any { + if m != nil { + return m.HasAnimal + } + return nil +} + +type HasHasHasAnimal struct { + HasHasAnimal *any.Any `protobuf:"bytes,1,opt,name=has_has_animal,json=hasHasAnimal,proto3" json:"has_has_animal,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HasHasHasAnimal) Reset() { *m = HasHasHasAnimal{} } +func (m *HasHasHasAnimal) String() string { return proto.CompactTextString(m) } +func (*HasHasHasAnimal) ProtoMessage() {} +func (*HasHasHasAnimal) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{5} +} +func (m *HasHasHasAnimal) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HasHasHasAnimal.Unmarshal(m, b) +} +func (m *HasHasHasAnimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HasHasHasAnimal.Marshal(b, m, deterministic) +} +func (m *HasHasHasAnimal) XXX_Merge(src proto.Message) { + xxx_messageInfo_HasHasHasAnimal.Merge(m, src) +} +func (m *HasHasHasAnimal) XXX_Size() int { + return xxx_messageInfo_HasHasHasAnimal.Size(m) +} +func (m *HasHasHasAnimal) XXX_DiscardUnknown() { + xxx_messageInfo_HasHasHasAnimal.DiscardUnknown(m) +} + +var xxx_messageInfo_HasHasHasAnimal proto.InternalMessageInfo + +func (m *HasHasHasAnimal) GetHasHasAnimal() *any.Any { + if m != nil { + return m.HasHasAnimal + } + return nil +} + +// bad MultiSignature with extra fields +type BadMultiSignature struct { + Signatures [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` + MaliciousField []byte `protobuf:"bytes,5,opt,name=malicious_field,json=maliciousField,proto3" json:"malicious_field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BadMultiSignature) Reset() { *m = BadMultiSignature{} } +func (m *BadMultiSignature) String() string { return proto.CompactTextString(m) } +func (*BadMultiSignature) ProtoMessage() {} +func (*BadMultiSignature) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{6} +} +func (m *BadMultiSignature) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BadMultiSignature.Unmarshal(m, b) +} +func (m *BadMultiSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BadMultiSignature.Marshal(b, m, deterministic) +} +func (m *BadMultiSignature) XXX_Merge(src proto.Message) { + xxx_messageInfo_BadMultiSignature.Merge(m, src) +} +func (m *BadMultiSignature) XXX_Size() int { + return xxx_messageInfo_BadMultiSignature.Size(m) +} +func (m *BadMultiSignature) XXX_DiscardUnknown() { + xxx_messageInfo_BadMultiSignature.DiscardUnknown(m) +} + +var xxx_messageInfo_BadMultiSignature proto.InternalMessageInfo + +func (m *BadMultiSignature) GetSignatures() [][]byte { + if m != nil { + return m.Signatures + } + return nil +} + +func (m *BadMultiSignature) GetMaliciousField() []byte { + if m != nil { + return m.MaliciousField + } + return nil +} + +type TableModel struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Number uint64 `protobuf:"varint,3,opt,name=number,proto3" json:"number,omitempty"` + Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TableModel) Reset() { *m = TableModel{} } +func (m *TableModel) String() string { return proto.CompactTextString(m) } +func (*TableModel) ProtoMessage() {} +func (*TableModel) Descriptor() ([]byte, []int) { + return fileDescriptor_06effb99b55a0a0d, []int{7} +} +func (m *TableModel) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TableModel.Unmarshal(m, b) +} +func (m *TableModel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TableModel.Marshal(b, m, deterministic) +} +func (m *TableModel) XXX_Merge(src proto.Message) { + xxx_messageInfo_TableModel.Merge(m, src) +} +func (m *TableModel) XXX_Size() int { + return xxx_messageInfo_TableModel.Size(m) +} +func (m *TableModel) XXX_DiscardUnknown() { + xxx_messageInfo_TableModel.DiscardUnknown(m) +} + +var xxx_messageInfo_TableModel proto.InternalMessageInfo + +func (m *TableModel) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *TableModel) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TableModel) GetNumber() uint64 { + if m != nil { + return m.Number + } + return 0 +} + +func (m *TableModel) GetMetadata() []byte { + if m != nil { + return m.Metadata + } + return nil +} + +func init() { + proto.RegisterType((*Dog)(nil), "testdata.Dog") + proto.RegisterType((*Cat)(nil), "testdata.Cat") + proto.RegisterType((*Bird)(nil), "testdata.Bird") + proto.RegisterType((*HasAnimal)(nil), "testdata.HasAnimal") + proto.RegisterType((*HasHasAnimal)(nil), "testdata.HasHasAnimal") + proto.RegisterType((*HasHasHasAnimal)(nil), "testdata.HasHasHasAnimal") + proto.RegisterType((*BadMultiSignature)(nil), "testdata.BadMultiSignature") + proto.RegisterType((*TableModel)(nil), "testdata.TableModel") +} + +func init() { proto.RegisterFile("testdata/testdata.proto", fileDescriptor_06effb99b55a0a0d) } + +var fileDescriptor_06effb99b55a0a0d = []byte{ + // 382 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0xef, 0xd2, 0x30, + 0x18, 0xc6, 0x33, 0x36, 0x10, 0x5e, 0x17, 0x88, 0x0d, 0xd1, 0xc9, 0x41, 0x49, 0x2f, 0x72, 0xd0, + 0x2d, 0x91, 0xe8, 0x81, 0x1b, 0x60, 0x94, 0x0b, 0x97, 0xe9, 0x9d, 0x74, 0xb4, 0x8c, 0xc6, 0x6e, + 0x25, 0x6b, 0x67, 0xc0, 0x6f, 0xe3, 0x37, 0xf2, 0x23, 0xfd, 0xd3, 0x6e, 0x05, 0x0e, 0xff, 0x03, + 0xb7, 0xe7, 0x79, 0xfa, 0xfe, 0x9e, 0xed, 0xdd, 0x0a, 0x6f, 0x34, 0x53, 0x9a, 0x12, 0x4d, 0x12, + 0x27, 0xe2, 0x53, 0x25, 0xb5, 0x44, 0x7d, 0xe7, 0x27, 0xe3, 0x5c, 0xe6, 0xd2, 0x86, 0x89, 0x51, + 0xcd, 0xf9, 0xe4, 0x6d, 0x2e, 0x65, 0x2e, 0x58, 0x62, 0x5d, 0x56, 0x1f, 0x12, 0x52, 0x5e, 0x9a, + 0x23, 0xfc, 0x09, 0xfc, 0x6f, 0x32, 0x47, 0x08, 0x02, 0xc5, 0xff, 0xb2, 0xc8, 0x9b, 0x7a, 0xb3, + 0x41, 0x6a, 0xb5, 0xc9, 0x4a, 0x52, 0xb0, 0xa8, 0xd3, 0x64, 0x46, 0xe3, 0x2f, 0xe0, 0xaf, 0x89, + 0x46, 0x11, 0xbc, 0x28, 0x64, 0xc9, 0x7f, 0xb3, 0xaa, 0x25, 0x9c, 0x45, 0x63, 0xe8, 0x0a, 0xfe, + 0x87, 0x29, 0x4b, 0x75, 0xd3, 0xc6, 0xe0, 0xaf, 0x10, 0xac, 0x78, 0x45, 0x0d, 0xa7, 0x4e, 0x6c, + 0xcf, 0x99, 0x72, 0x5c, 0x6b, 0x0d, 0xb7, 0x97, 0x42, 0x56, 0x8e, 0xb3, 0x06, 0xff, 0x80, 0xc1, + 0x86, 0xa8, 0x65, 0xc9, 0x0b, 0x22, 0xd0, 0x47, 0xe8, 0x11, 0xab, 0x2c, 0xfb, 0xf2, 0xf3, 0x38, + 0x6e, 0xd6, 0x8a, 0xdd, 0x5a, 0xf1, 0xb2, 0xbc, 0xa4, 0xed, 0x0c, 0x0a, 0xc1, 0x3b, 0xdb, 0x32, + 0x3f, 0xf5, 0xce, 0x78, 0x0d, 0xe1, 0x86, 0xa8, 0x5b, 0xd7, 0x1c, 0xe0, 0x48, 0xd4, 0xee, 0x81, + 0xbe, 0xc1, 0xd1, 0x41, 0x78, 0x0b, 0xa3, 0xa6, 0xe4, 0xd6, 0xb3, 0x80, 0xa1, 0xe9, 0x79, 0xb0, + 0x2b, 0x3c, 0xde, 0xb1, 0x38, 0x83, 0x57, 0x2b, 0x42, 0xb7, 0xb5, 0xd0, 0xfc, 0x27, 0xcf, 0x4b, + 0xa2, 0xeb, 0x8a, 0xa1, 0x77, 0x00, 0xca, 0x19, 0xf3, 0x91, 0xfc, 0x59, 0x98, 0xde, 0x25, 0xe8, + 0x03, 0x8c, 0x0a, 0x22, 0xf8, 0x9e, 0xcb, 0x5a, 0xed, 0x0e, 0x9c, 0x09, 0x1a, 0x75, 0xa7, 0xde, + 0x2c, 0x4c, 0x87, 0xd7, 0xf8, 0xbb, 0x49, 0x17, 0xc1, 0xff, 0x7f, 0xef, 0x3d, 0x4c, 0x01, 0x7e, + 0x91, 0x4c, 0xb0, 0xad, 0xa4, 0x4c, 0xa0, 0x21, 0x74, 0x38, 0xb5, 0x6f, 0x18, 0xa4, 0x1d, 0x4e, + 0x9f, 0xfb, 0xc3, 0xe8, 0x35, 0xf4, 0xca, 0xba, 0xc8, 0x58, 0x15, 0xf9, 0x76, 0xae, 0x75, 0x68, + 0x02, 0xfd, 0x82, 0x69, 0x62, 0x6e, 0x59, 0x14, 0xd8, 0x27, 0x5e, 0x7d, 0xd6, 0xb3, 0x5b, 0xce, + 0x9f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x26, 0xb9, 0xbf, 0xa1, 0x02, 0x00, 0x00, +} diff --git a/test/testdata/testdata.proto b/test/testdata/testdata.proto new file mode 100644 index 00000000..e1dbdd25 --- /dev/null +++ b/test/testdata/testdata.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package testdata; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +message Dog { + string size = 1; + string name = 2; +} + +message Cat { + string moniker = 1; + int32 lives = 2; +} + +message Bird { + string species = 1; + int32 color = 2; +} + +message HasAnimal { + google.protobuf.Any animal = 1; + int64 x = 2; +} + +message HasHasAnimal { + google.protobuf.Any has_animal = 1; +} + +message HasHasHasAnimal { + google.protobuf.Any has_has_animal = 1; +} + +// bad MultiSignature with extra fields +message BadMultiSignature { + option (gogoproto.goproto_unrecognized) = true; + repeated bytes signatures = 1; + bytes malicious_field = 5; +} + +message TableModel { + uint64 id = 1; + string name = 2; + uint64 number = 3; + bytes metadata = 4; +}