| 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package proto_testscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/ |
| 6 | |
| 7 | import ( |
| 8 | "flagscip-go gomod github.com/golang/go/src go1.23 flag/" |
| 9 | "fmtscip-go gomod github.com/golang/go/src go1.23 fmt/" |
| 10 | "osscip-go gomod github.com/golang/go/src go1.23 os/" |
| 11 | "stringsscip-go gomod github.com/golang/go/src go1.23 strings/" |
| 12 | "testingscip-go gomod github.com/golang/go/src go1.23 testing/" |
| 13 | |
| 14 | "google.golang.org/protobuf/internal/implscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/impl`/" |
| 15 | "google.golang.org/protobuf/internal/protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/" |
| 16 | "google.golang.org/protobuf/reflect/protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/" |
| 17 | "google.golang.org/protobuf/reflect/protoregistryscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/" |
| 18 | "google.golang.org/protobuf/testing/protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/" |
| 19 | |
| 20 | _ "google.golang.org/protobuf/internal/testprotos/lazyscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/lazy`/" |
| 21 | _ "google.golang.org/protobuf/internal/testprotos/lazy/lazy_opaquescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/lazy/lazy_opaque`/" |
| 22 | _ "google.golang.org/protobuf/internal/testprotos/requiredscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/required`/" |
| 23 | _ "google.golang.org/protobuf/internal/testprotos/required/required_opaquescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/required/required_opaque`/" |
| 24 | _ "google.golang.org/protobuf/internal/testprotos/testscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/" |
| 25 | _ "google.golang.org/protobuf/internal/testprotos/test3scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/" |
| 26 | _ "google.golang.org/protobuf/internal/testprotos/testeditions/testeditions_hybridscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/testeditions/testeditions_hybrid`/" |
| 27 | _ "google.golang.org/protobuf/internal/testprotos/testeditions/testeditions_opaquescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/testeditions/testeditions_opaque`/" |
| 28 | ) |
| 29 | |
| 30 | var testLazyUnmarshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testLazyUnmarshal. = flagscip-go gomod github.com/golang/go/src go1.23 flag/.Boolscip-go gomod github.com/golang/go/src go1.23 flag/Bool().("test_lazy_unmarshal", false, "test lazy proto.Unmarshal") |
| 31 | |
| 32 | func TestMainscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestMain().(m *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Mscip-go gomod github.com/golang/go/src go1.23 testing/M#) { |
| 33 | flagscip-go gomod github.com/golang/go/src go1.23 flag/.Parsescip-go gomod github.com/golang/go/src go1.23 flag/Parse().() |
| 34 | implscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/impl`/.EnableLazyUnmarshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/impl`/EnableLazyUnmarshal().(*testLazyUnmarshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testLazyUnmarshal.) |
| 35 | osscip-go gomod github.com/golang/go/src go1.23 os/.Exitscip-go gomod github.com/golang/go/src go1.23 os/Exit().(m.Runscip-go gomod github.com/golang/go/src go1.23 testing/M#Run().()) |
| 36 | } |
| 37 | |
| 38 | var relatedMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages. = func() map[protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.MessageTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#][]protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.MessageTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType# { |
| 39 | related := map[protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.MessageTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#][]protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.MessageTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#{} |
| 40 | const opaqueNamePrefixscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages:opaqueNamePrefix. = "opaque." |
| 41 | protoregistryscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/.GlobalTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/GlobalTypes..RangeMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/Types#RangeMessages().(func(mtscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages:mt. protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.MessageTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#) bool { |
| 42 | name := mtscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages:mt..Descriptorscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#Descriptor.().FullNamescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Descriptor#FullName.() |
| 43 | if !stringsscip-go gomod github.com/golang/go/src go1.23 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.23 strings/HasPrefix().(string(name), opaqueNamePrefixscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages:opaqueNamePrefix.) { |
| 44 | return true |
| 45 | } |
| 46 | mt1, err := protoregistryscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/.GlobalTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/GlobalTypes..FindMessageByNamescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoregistry`/Types#FindMessageByName().(name[len(opaqueNamePrefixscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages:opaqueNamePrefix.):]) |
| 47 | if err != nil { |
| 48 | panic(fmtscip-go gomod github.com/golang/go/src go1.23 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23 fmt/Sprintf().("%v: can't find related message", name)) |
| 49 | } |
| 50 | related[mt1] = append(related[mt1], mtscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/relatedMessages:mt.) |
| 51 | return true |
| 52 | }) |
| 53 | return related |
| 54 | }() |
| 55 | |
| 56 | func initscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/init().() { |
| 57 | testValidMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testValidMessages. = append(testValidMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testValidMessages., []testProtoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#{ |
| 58 | { |
| 59 | descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#desc.: "lazy field contains wrong wire type", |
| 60 | checkFastInitscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#checkFastInit.: true, |
| 61 | decodeToscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#decodeTo.: makeMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/makeMessages().(protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#{ |
| 62 | "optional_nested_message": protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#{ |
| 63 | protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Unknownscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Unknown.: protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 64 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{2, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.VarintTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/VarintType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Varintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Varint#(3), |
| 65 | }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(), |
| 66 | }, |
| 67 | }), |
| 68 | wirescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#wire.: protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 69 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{18, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.BytesTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/BytesType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.LengthPrefixscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/LengthPrefix#(protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 70 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{2, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.VarintTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/VarintType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Varintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Varint#(3), |
| 71 | }), |
| 72 | }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(), |
| 73 | }, { |
| 74 | descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#desc.: "lazy field contains right and wrong wire type", |
| 75 | checkFastInitscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#checkFastInit.: true, |
| 76 | decodeToscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#decodeTo.: makeMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/makeMessages().(protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#{ |
| 77 | "optional_nested_message": protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#{ |
| 78 | "corecursive": protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#{ |
| 79 | "optional_int32": 2, |
| 80 | }, |
| 81 | protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/.Unknownscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Unknown.: protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 82 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{2, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.VarintTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/VarintType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Varintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Varint#(3), |
| 83 | }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(), |
| 84 | }, |
| 85 | }), |
| 86 | wirescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testProto#wire.: protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 87 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{18, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.BytesTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/BytesType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.LengthPrefixscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/LengthPrefix#(protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 88 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{2, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.BytesTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/BytesType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.LengthPrefixscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/LengthPrefix#(protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#{ |
| 89 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{1, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.VarintTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/VarintType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Varintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Varint#(2), |
| 90 | }), |
| 91 | protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Tagscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#{2, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.VarintTypescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/VarintType.}, protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/.Varintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Varint#(3), |
| 92 | }), |
| 93 | }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(), |
| 94 | }, |
| 95 | }...) |
| 96 | } |