Debian Codegraph @

proto/merge_test.go

raw symbols SCIP
1 // Copyright 2019 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 "fmtscip-go gomod github.com/golang/go/src go1.23 fmt/"
9 "reflectscip-go gomod github.com/golang/go/src go1.23 reflect/"
10 "syncscip-go gomod github.com/golang/go/src go1.23 sync/"
11 "testingscip-go gomod github.com/golang/go/src go1.23 testing/"
12
13 "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/"
14
15 "google.golang.org/protobuf/encoding/prototextscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/encoding/prototext`/"
16 "google.golang.org/protobuf/internal/protobuildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/"
17 "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/"
18 "google.golang.org/protobuf/reflect/protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/"
19 "google.golang.org/protobuf/testing/protocmpscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/"
20 "google.golang.org/protobuf/testing/protopackscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/"
21 "google.golang.org/protobuf/types/dynamicpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/types/dynamicpb`/"
22
23 legacypbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/legacy`/ "google.golang.org/protobuf/internal/testprotos/legacyscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/legacy`/"
24 testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/ "google.golang.org/protobuf/internal/testprotos/testscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/"
25 test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/ "google.golang.org/protobuf/internal/testprotos/test3scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/"
26 )
27
28 type testMergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge# struct {
29 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc. string
30 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst. 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#
31 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src. 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#
32 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want. 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# // if dst and want are nil, want = src
33 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types. []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#
34 }
35
36 var testMergesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerges. = []testMergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#{{
37 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone a large message",
38 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
39 "optional_int32": 1001,
40 "optional_int64": 1002,
41 "optional_uint32": 1003,
42 "optional_uint64": 1004,
43 "optional_sint32": 1005,
44 "optional_sint64": 1006,
45 "optional_fixed32": 1007,
46 "optional_fixed64": 1008,
47 "optional_sfixed32": 1009,
48 "optional_sfixed64": 1010,
49 "optional_float": 1011.5,
50 "optional_double": 1012.5,
51 "optional_bool": true,
52 "optional_string": "string",
53 "optional_bytes": []byte("bytes"),
54 "optional_nested_enum": 1,
55 "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#{
56 "a": 100,
57 },
58 "repeated_int32": []int32{1001, 2001},
59 "repeated_int64": []int64{1002, 2002},
60 "repeated_uint32": []uint32{1003, 2003},
61 "repeated_uint64": []uint64{1004, 2004},
62 "repeated_sint32": []int32{1005, 2005},
63 "repeated_sint64": []int64{1006, 2006},
64 "repeated_fixed32": []uint32{1007, 2007},
65 "repeated_fixed64": []uint64{1008, 2008},
66 "repeated_sfixed32": []int32{1009, 2009},
67 "repeated_sfixed64": []int64{1010, 2010},
68 "repeated_float": []float32{1011.5, 2011.5},
69 "repeated_double": []float64{1012.5, 2012.5},
70 "repeated_bool": []bool{true, false},
71 "repeated_string": []string{"foo", "bar"},
72 "repeated_bytes": []string{"FOO", "BAR"},
73 "repeated_nested_enum": []string{"FOO", "BAR"},
74 "repeated_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#{
75 {"a": 200},
76 {"a": 300},
77 },
78 },
79 }, {
80 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone maps",
81 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
82 "map_int32_int32": map[int32]int32{1056: 1156, 2056: 2156},
83 "map_int64_int64": map[int64]int64{1057: 1157, 2057: 2157},
84 "map_uint32_uint32": map[uint32]uint32{1058: 1158, 2058: 2158},
85 "map_uint64_uint64": map[uint64]uint64{1059: 1159, 2059: 2159},
86 "map_sint32_sint32": map[int32]int32{1060: 1160, 2060: 2160},
87 "map_sint64_sint64": map[int64]int64{1061: 1161, 2061: 2161},
88 "map_fixed32_fixed32": map[uint32]uint32{1062: 1162, 2062: 2162},
89 "map_fixed64_fixed64": map[uint64]uint64{1063: 1163, 2063: 2163},
90 "map_sfixed32_sfixed32": map[int32]int32{1064: 1164, 2064: 2164},
91 "map_sfixed64_sfixed64": map[int64]int64{1065: 1165, 2065: 2165},
92 "map_int32_float": map[int32]float32{1066: 1166.5, 2066: 2166.5},
93 "map_int32_double": map[int32]float64{1067: 1167.5, 2067: 2167.5},
94 "map_bool_bool": map[bool]bool{true: false, false: true},
95 "map_string_string": map[string]string{"69.1.key": "69.1.val", "69.2.key": "69.2.val"},
96 "map_string_bytes": map[string][]byte{"70.1.key": []byte("70.1.val"), "70.2.key": []byte("70.2.val")},
97 "map_string_nested_message": map[string]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#{
98 "71.1.key": {"a": 1171},
99 "71.2.key": {"a": 2171},
100 },
101 "map_string_nested_enum": map[string]string{"73.1.key": "FOO", "73.2.key": "BAR"},
102 },
103 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
104 }, {
105 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof uint32",
106 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
107 "oneof_uint32": 1111,
108 },
109 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
110 }, {
111 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof string",
112 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
113 "oneof_string": "string",
114 },
115 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
116 }, {
117 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof bytes",
118 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
119 "oneof_bytes": "bytes",
120 },
121 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
122 }, {
123 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof bool",
124 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
125 "oneof_bool": true,
126 },
127 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
128 }, {
129 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof uint64",
130 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
131 "oneof_uint64": 100,
132 },
133 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
134 }, {
135 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof float",
136 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
137 "oneof_float": 100,
138 },
139 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
140 }, {
141 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof double",
142 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
143 "oneof_double": 1111,
144 },
145 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
146 }, {
147 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof enum",
148 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
149 "oneof_enum": 1,
150 },
151 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
152 }, {
153 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof message",
154 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
155 "oneof_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#{
156 "a": 1,
157 },
158 },
159 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
160 }, {
161 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone oneof group",
162 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
163 "oneofgroup": 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#{
164 "a": 1,
165 },
166 },
167 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}},
168 }, {
169 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge bytes",
170 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
171 "optional_bytes": []byte{1, 2, 3},
172 "repeated_bytes": [][]byte{{1, 2}, {3, 4}},
173 "map_string_bytes": map[string][]byte{"alpha": {1, 2, 3}},
174 },
175 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
176 "optional_bytes": []byte{4, 5, 6},
177 "repeated_bytes": [][]byte{{5, 6}, {7, 8}},
178 "map_string_bytes": map[string][]byte{"alpha": {4, 5, 6}, "bravo": {1, 2, 3}},
179 },
180 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
181 "optional_bytes": []byte{4, 5, 6},
182 "repeated_bytes": [][]byte{{1, 2}, {3, 4}, {5, 6}, {7, 8}},
183 "map_string_bytes": map[string][]byte{"alpha": {4, 5, 6}, "bravo": {1, 2, 3}},
184 },
185 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
186 }, {
187 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge singular fields",
188 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
189 "optional_int32": 1,
190 "optional_int64": 1,
191 "optional_uint32": 1,
192 "optional_uint64": 1,
193 "optional_sint32": 1,
194 "optional_sint64": 1,
195 "optional_fixed32": 1,
196 "optional_fixed64": 1,
197 "optional_sfixed32": 1,
198 "optional_sfixed64": 1,
199 "optional_float": 1,
200 "optional_double": 1,
201 "optional_bool": false,
202 "optional_string": "1",
203 "optional_bytes": "1",
204 "optional_nested_enum": 1,
205 "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#{
206 "a": 1,
207 "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#{
208 "optional_int64": 1,
209 },
210 },
211 },
212 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
213 "optional_int32": 2,
214 "optional_int64": 2,
215 "optional_uint32": 2,
216 "optional_uint64": 2,
217 "optional_sint32": 2,
218 "optional_sint64": 2,
219 "optional_fixed32": 2,
220 "optional_fixed64": 2,
221 "optional_sfixed32": 2,
222 "optional_sfixed64": 2,
223 "optional_float": 2,
224 "optional_double": 2,
225 "optional_bool": true,
226 "optional_string": "2",
227 "optional_bytes": "2",
228 "optional_nested_enum": 2,
229 "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#{
230 "a": 2,
231 "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#{
232 "optional_int64": 2,
233 },
234 },
235 },
236 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
237 "optional_int32": 2,
238 "optional_int64": 2,
239 "optional_uint32": 2,
240 "optional_uint64": 2,
241 "optional_sint32": 2,
242 "optional_sint64": 2,
243 "optional_fixed32": 2,
244 "optional_fixed64": 2,
245 "optional_sfixed32": 2,
246 "optional_sfixed64": 2,
247 "optional_float": 2,
248 "optional_double": 2,
249 "optional_bool": true,
250 "optional_string": "2",
251 "optional_bytes": "2",
252 "optional_nested_enum": 2,
253 "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#{
254 "a": 2,
255 "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#{
256 "optional_int64": 2,
257 },
258 },
259 },
260 }, {
261 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "no merge of empty singular fields",
262 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
263 "optional_int32": 1,
264 "optional_int64": 1,
265 "optional_uint32": 1,
266 "optional_uint64": 1,
267 "optional_sint32": 1,
268 "optional_sint64": 1,
269 "optional_fixed32": 1,
270 "optional_fixed64": 1,
271 "optional_sfixed32": 1,
272 "optional_sfixed64": 1,
273 "optional_float": 1,
274 "optional_double": 1,
275 "optional_bool": false,
276 "optional_string": "1",
277 "optional_bytes": "1",
278 "optional_nested_enum": 1,
279 "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#{
280 "a": 1,
281 "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#{
282 "optional_int64": 1,
283 },
284 },
285 },
286 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
287 "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#{
288 "a": 1,
289 "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#{
290 "optional_int32": 2,
291 },
292 },
293 },
294 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
295 "optional_int32": 1,
296 "optional_int64": 1,
297 "optional_uint32": 1,
298 "optional_uint64": 1,
299 "optional_sint32": 1,
300 "optional_sint64": 1,
301 "optional_fixed32": 1,
302 "optional_fixed64": 1,
303 "optional_sfixed32": 1,
304 "optional_sfixed64": 1,
305 "optional_float": 1,
306 "optional_double": 1,
307 "optional_bool": false,
308 "optional_string": "1",
309 "optional_bytes": "1",
310 "optional_nested_enum": 1,
311 "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#{
312 "a": 1,
313 "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#{
314 "optional_int32": 2,
315 "optional_int64": 1,
316 },
317 },
318 },
319 }, {
320 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge list fields",
321 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
322 "repeated_int32": []int32{1, 2, 3},
323 "repeated_int64": []int64{1, 2, 3},
324 "repeated_uint32": []uint32{1, 2, 3},
325 "repeated_uint64": []uint64{1, 2, 3},
326 "repeated_sint32": []int32{1, 2, 3},
327 "repeated_sint64": []int64{1, 2, 3},
328 "repeated_fixed32": []uint32{1, 2, 3},
329 "repeated_fixed64": []uint64{1, 2, 3},
330 "repeated_sfixed32": []int32{1, 2, 3},
331 "repeated_sfixed64": []int64{1, 2, 3},
332 "repeated_float": []float32{1, 2, 3},
333 "repeated_double": []float64{1, 2, 3},
334 "repeated_bool": []bool{true},
335 "repeated_string": []string{"a", "b", "c"},
336 "repeated_bytes": []string{"a", "b", "c"},
337 "repeated_nested_enum": []int{1, 2, 3},
338 "repeated_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#{
339 {"a": 100},
340 {"a": 200},
341 },
342 },
343 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
344 "repeated_int32": []int32{4, 5, 6},
345 "repeated_int64": []int64{4, 5, 6},
346 "repeated_uint32": []uint32{4, 5, 6},
347 "repeated_uint64": []uint64{4, 5, 6},
348 "repeated_sint32": []int32{4, 5, 6},
349 "repeated_sint64": []int64{4, 5, 6},
350 "repeated_fixed32": []uint32{4, 5, 6},
351 "repeated_fixed64": []uint64{4, 5, 6},
352 "repeated_sfixed32": []int32{4, 5, 6},
353 "repeated_sfixed64": []int64{4, 5, 6},
354 "repeated_float": []float32{4, 5, 6},
355 "repeated_double": []float64{4, 5, 6},
356 "repeated_bool": []bool{false},
357 "repeated_string": []string{"d", "e", "f"},
358 "repeated_bytes": []string{"d", "e", "f"},
359 "repeated_nested_enum": []int{4, 5, 6},
360 "repeated_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#{
361 {"a": 300},
362 {"a": 400},
363 },
364 },
365 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
366 "repeated_int32": []int32{1, 2, 3, 4, 5, 6},
367 "repeated_int64": []int64{1, 2, 3, 4, 5, 6},
368 "repeated_uint32": []uint32{1, 2, 3, 4, 5, 6},
369 "repeated_uint64": []uint64{1, 2, 3, 4, 5, 6},
370 "repeated_sint32": []int32{1, 2, 3, 4, 5, 6},
371 "repeated_sint64": []int64{1, 2, 3, 4, 5, 6},
372 "repeated_fixed32": []uint32{1, 2, 3, 4, 5, 6},
373 "repeated_fixed64": []uint64{1, 2, 3, 4, 5, 6},
374 "repeated_sfixed32": []int32{1, 2, 3, 4, 5, 6},
375 "repeated_sfixed64": []int64{1, 2, 3, 4, 5, 6},
376 "repeated_float": []float32{1, 2, 3, 4, 5, 6},
377 "repeated_double": []float64{1, 2, 3, 4, 5, 6},
378 "repeated_bool": []bool{true, false},
379 "repeated_string": []string{"a", "b", "c", "d", "e", "f"},
380 "repeated_bytes": []string{"a", "b", "c", "d", "e", "f"},
381 "repeated_nested_enum": []int{1, 2, 3, 4, 5, 6},
382 "repeated_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#{
383 {"a": 100},
384 {"a": 200},
385 {"a": 300},
386 {"a": 400},
387 },
388 },
389 }, {
390 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge map fields",
391 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
392 "map_int32_int32": map[int]int{1: 1, 3: 1},
393 "map_int64_int64": map[int]int{1: 1, 3: 1},
394 "map_uint32_uint32": map[int]int{1: 1, 3: 1},
395 "map_uint64_uint64": map[int]int{1: 1, 3: 1},
396 "map_sint32_sint32": map[int]int{1: 1, 3: 1},
397 "map_sint64_sint64": map[int]int{1: 1, 3: 1},
398 "map_fixed32_fixed32": map[int]int{1: 1, 3: 1},
399 "map_fixed64_fixed64": map[int]int{1: 1, 3: 1},
400 "map_sfixed32_sfixed32": map[int]int{1: 1, 3: 1},
401 "map_sfixed64_sfixed64": map[int]int{1: 1, 3: 1},
402 "map_int32_float": map[int]int{1: 1, 3: 1},
403 "map_int32_double": map[int]int{1: 1, 3: 1},
404 "map_bool_bool": map[bool]bool{true: true},
405 "map_string_string": map[string]string{"a": "1", "ab": "1"},
406 "map_string_bytes": map[string]string{"a": "1", "ab": "1"},
407 "map_string_nested_message": map[string]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#{
408 "a": {"a": 1},
409 "ab": {
410 "a": 1,
411 "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#{
412 "map_int32_int32": map[int]int{1: 1, 3: 1},
413 },
414 },
415 },
416 "map_string_nested_enum": map[string]int{"a": 1, "ab": 1},
417 },
418 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
419 "map_int32_int32": map[int]int{2: 2, 3: 2},
420 "map_int64_int64": map[int]int{2: 2, 3: 2},
421 "map_uint32_uint32": map[int]int{2: 2, 3: 2},
422 "map_uint64_uint64": map[int]int{2: 2, 3: 2},
423 "map_sint32_sint32": map[int]int{2: 2, 3: 2},
424 "map_sint64_sint64": map[int]int{2: 2, 3: 2},
425 "map_fixed32_fixed32": map[int]int{2: 2, 3: 2},
426 "map_fixed64_fixed64": map[int]int{2: 2, 3: 2},
427 "map_sfixed32_sfixed32": map[int]int{2: 2, 3: 2},
428 "map_sfixed64_sfixed64": map[int]int{2: 2, 3: 2},
429 "map_int32_float": map[int]int{2: 2, 3: 2},
430 "map_int32_double": map[int]int{2: 2, 3: 2},
431 "map_bool_bool": map[bool]bool{false: false},
432 "map_string_string": map[string]string{"b": "2", "ab": "2"},
433 "map_string_bytes": map[string]string{"b": "2", "ab": "2"},
434 "map_string_nested_message": map[string]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#{
435 "b": {"a": 2},
436 "ab": {
437 "a": 2,
438 "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#{
439 "map_int32_int32": map[int]int{2: 2, 3: 2},
440 },
441 },
442 },
443 "map_string_nested_enum": map[string]int{"b": 2, "ab": 2},
444 },
445 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
446 "map_int32_int32": map[int]int{1: 1, 2: 2, 3: 2},
447 "map_int64_int64": map[int]int{1: 1, 2: 2, 3: 2},
448 "map_uint32_uint32": map[int]int{1: 1, 2: 2, 3: 2},
449 "map_uint64_uint64": map[int]int{1: 1, 2: 2, 3: 2},
450 "map_sint32_sint32": map[int]int{1: 1, 2: 2, 3: 2},
451 "map_sint64_sint64": map[int]int{1: 1, 2: 2, 3: 2},
452 "map_fixed32_fixed32": map[int]int{1: 1, 2: 2, 3: 2},
453 "map_fixed64_fixed64": map[int]int{1: 1, 2: 2, 3: 2},
454 "map_sfixed32_sfixed32": map[int]int{1: 1, 2: 2, 3: 2},
455 "map_sfixed64_sfixed64": map[int]int{1: 1, 2: 2, 3: 2},
456 "map_int32_float": map[int]int{1: 1, 2: 2, 3: 2},
457 "map_int32_double": map[int]int{1: 1, 2: 2, 3: 2},
458 "map_bool_bool": map[bool]bool{true: true, false: false},
459 "map_string_string": map[string]string{"a": "1", "b": "2", "ab": "2"},
460 "map_string_bytes": map[string]string{"a": "1", "b": "2", "ab": "2"},
461 "map_string_nested_message": map[string]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#{
462 "a": {"a": 1},
463 "b": {"a": 2},
464 "ab": {
465 "a": 2,
466 "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#{
467 // The map item "ab" was entirely replaced, so
468 // this does not contain 1:1 from dst.
469 "map_int32_int32": map[int]int{2: 2, 3: 2},
470 },
471 },
472 },
473 "map_string_nested_enum": map[string]int{"a": 1, "b": 2, "ab": 2},
474 },
475 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
476 }, {
477 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge oneof message fields",
478 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
479 "oneof_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#{
480 "a": 100,
481 },
482 },
483 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
484 "oneof_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#{
485 "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#{
486 "optional_int64": 1000,
487 },
488 },
489 },
490 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
491 "oneof_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#{
492 "a": 100,
493 "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#{
494 "optional_int64": 1000,
495 },
496 },
497 },
498 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
499 }, {
500 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge oneof scalar fields",
501 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
502 "oneof_uint32": 100,
503 },
504 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
505 "oneof_float": 3.14152,
506 },
507 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
508 "oneof_float": 3.14152,
509 },
510 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}, &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{}},
511 }, {
512 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "merge unknown fields",
513 dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst.: 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#{
514 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#{
515 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 50000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-5),
516 }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(),
517 },
518 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{
519 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#{
520 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 500000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-50),
521 }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(),
522 },
523 wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want.: 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#{
524 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#{
525 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 50000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-5),
526 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 500000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-50),
527 }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().(),
528 },
529 }, {
530 descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc.: "clone legacy message",
531 srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src.: 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#{"f1": 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#{
532 "optional_int32": 1,
533 "optional_int64": 1,
534 "optional_uint32": 1,
535 "optional_uint64": 1,
536 "optional_sint32": 1,
537 "optional_sint64": 1,
538 "optional_fixed32": 1,
539 "optional_fixed64": 1,
540 "optional_sfixed32": 1,
541 "optional_sfixed64": 1,
542 "optional_float": 1,
543 "optional_double": 1,
544 "optional_bool": true,
545 "optional_string": "string",
546 "optional_bytes": "bytes",
547 "optional_sibling_enum": 1,
548 "optional_sibling_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#{
549 "f1": "value",
550 },
551 "repeated_int32": []int32{1},
552 "repeated_int64": []int64{1},
553 "repeated_uint32": []uint32{1},
554 "repeated_uint64": []uint64{1},
555 "repeated_sint32": []int32{1},
556 "repeated_sint64": []int64{1},
557 "repeated_fixed32": []uint32{1},
558 "repeated_fixed64": []uint64{1},
559 "repeated_sfixed32": []int32{1},
560 "repeated_sfixed64": []int64{1},
561 "repeated_float": []float32{1},
562 "repeated_double": []float64{1},
563 "repeated_bool": []bool{true},
564 "repeated_string": []string{"string"},
565 "repeated_bytes": []string{"bytes"},
566 "repeated_sibling_enum": []int{1},
567 "repeated_sibling_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#{
568 {"f1": "1"},
569 },
570 "map_bool_int32": map[bool]int{true: 1},
571 "map_bool_int64": map[bool]int{true: 1},
572 "map_bool_uint32": map[bool]int{true: 1},
573 "map_bool_uint64": map[bool]int{true: 1},
574 "map_bool_sint32": map[bool]int{true: 1},
575 "map_bool_sint64": map[bool]int{true: 1},
576 "map_bool_fixed32": map[bool]int{true: 1},
577 "map_bool_fixed64": map[bool]int{true: 1},
578 "map_bool_sfixed32": map[bool]int{true: 1},
579 "map_bool_sfixed64": map[bool]int{true: 1},
580 "map_bool_float": map[bool]int{true: 1},
581 "map_bool_double": map[bool]int{true: 1},
582 "map_bool_bool": map[bool]bool{true: false},
583 "map_bool_string": map[bool]string{true: "1"},
584 "map_bool_bytes": map[bool]string{true: "1"},
585 "map_bool_sibling_message": map[bool]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#{
586 true: {"f1": "1"},
587 },
588 "map_bool_sibling_enum": map[bool]int{true: 1},
589 "oneof_sibling_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#{
590 "f1": "1",
591 },
592 }},
593 typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types.: []protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#{&legacypbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/legacy`/.Legacyscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/legacy`/Legacy#{}},
594 }}
595
596 func TestMergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestMerge().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
597 for _, tt := range testMergesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerges. {
598 for _, mt := range templateMessagesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/templateMessages().(tt.typesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#types....) {
599 t.Runscip-go gomod github.com/golang/go/src go1.23 testing/T#Run().(fmtscip-go gomod github.com/golang/go/src go1.23 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23 fmt/Sprintf().("%s (%v)", tt.descscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#desc., 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.()), func(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
600 dst := mt.Newscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#New.().Interfacescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#Interface.()
601 tt.dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst..Buildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#Build().(dst.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect.())
602
603 src := mt.Newscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#New.().Interfacescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#Interface.()
604 tt.srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src..Buildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#Build().(src.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect.())
605
606 want := mt.Newscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#New.().Interfacescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#Interface.()
607 if tt.dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst. == nil && tt.wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want. == nil {
608 tt.srcscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#src..Buildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#Build().(want.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect.())
609 } else {
610 tt.wantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#want..Buildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#Build().(want.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect.())
611 }
612
613 // Merge should be semantically equivalent to unmarshaling the
614 // encoded form of src into the current dst.
615 b1, err := protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.MarshalOptionsscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/MarshalOptions#{AllowPartialscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/MarshalOptions#AllowPartial.: true}.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/MarshalOptions#Marshal().(dst)
616 if err != nil {
617 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("Marshal(dst) error: %v", err)
618 }
619 b2, err := protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.MarshalOptionsscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/MarshalOptions#{AllowPartialscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/MarshalOptions#AllowPartial.: true}.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/MarshalOptions#Marshal().(src)
620 if err != nil {
621 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("Marshal(src) error: %v", err)
622 }
623 unmarshaled := dst.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect.().Newscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#New.().Interfacescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#Interface.()
624 err = protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.UnmarshalOptionsscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/UnmarshalOptions#{AllowPartialscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/UnmarshalOptions#AllowPartial.: true}.Unmarshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/UnmarshalOptions#Unmarshal().(append(b1, b2...), unmarshaled)
625 if err != nil {
626 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("Unmarshal() error: %v", err)
627 }
628 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(unmarshaled, want) {
629 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("Unmarshal(Marshal(dst)+Marshal(src)) mismatch:\n got %v\nwant %v\ndiff (-want,+got):\n%v", unmarshaled, want, cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(want, unmarshaled, protocmpscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/.Transformscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/Transform().()))
630 }
631
632 // Test heterogeneous MessageTypes by merging into a
633 // dynamic message.
634 ddst := dynamicpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/types/dynamicpb`/.NewMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/types/dynamicpb`/NewMessage().(mt.Descriptorscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MessageType#Descriptor.())
635 tt.dstscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/testMerge#dst..Buildscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/protobuild`/Message#Build().(ddst.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/types/dynamicpb`/Message#ProtoReflect().())
636 protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Mergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Merge().(ddst, src)
637 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(ddst, want) {
638 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("Merge() into dynamic message mismatch:\n got %v\nwant %v\ndiff (-want,+got):\n%v", ddst, want, cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(want, ddst, protocmpscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/.Transformscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/Transform().()))
639 }
640
641 protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Mergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Merge().(dst, src)
642 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(dst, want) {
643 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("Merge() mismatch:\n got %v\nwant %v\ndiff (-want,+got):\n%v", dst, want, cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(want, dst, protocmpscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/.Transformscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/Transform().()))
644 }
645 mutateValuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/mutateValue().(protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfMessage().(src.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect.()))
646 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(dst, want) {
647 t.Fatalfscip-go gomod github.com/golang/go/src go1.23 testing/common#Fatalf().("mutation observed after modifying source:\n got %v\nwant %v\ndiff (-want,+got):\n%v", dst, want, cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(want, dst, protocmpscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/.Transformscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protocmp`/Transform().()))
648 }
649 })
650 }
651 }
652 }
653
654 func TestMergeFromNilscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestMergeFromNil().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
655 dst := &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}
656 protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Mergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Merge().(dst, (*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#)(nil))
657 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(dst, &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{}) {
658 t.Errorfscip-go gomod github.com/golang/go/src go1.23 testing/common#Errorf().("destination should be empty after merging from nil message; got:\n%v", prototextscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/encoding/prototext`/.Formatscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/encoding/prototext`/Format().(dst))
659 }
660 }
661
662 // TestMergeAberrant tests inputs that are beyond the protobuf data model.
663 // Just because there is a test for the current behavior does not mean that
664 // this will behave the same way in the future.
665 func TestMergeAberrantscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestMergeAberrant().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
666 tests := []struct {
667 label string
668 dst protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#
669 src protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#
670 check func(protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool
671 }{{
672 label: "Proto2EmptyBytes",
673 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{OptionalBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalBytes.: nil},
674 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{OptionalBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalBytes.: []byte{}},
675 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
676 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).OptionalBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalBytes. != nil
677 },
678 }, {
679 label: "Proto3EmptyBytes",
680 dst: &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{SingularBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#SingularBytes.: nil},
681 src: &test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#{SingularBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#SingularBytes.: []byte{}},
682 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
683 return m.(*test3pbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#).SingularBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test3`/TestAllTypes#SingularBytes. == nil
684 },
685 }, {
686 label: "EmptyList",
687 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedInt32.: nil},
688 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedInt32.: []int32{}},
689 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
690 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).RepeatedInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedInt32. == nil
691 },
692 }, {
693 label: "ListWithNilBytes",
694 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedBytes.: nil},
695 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedBytes.: [][]byte{nil}},
696 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
697 return reflectscip-go gomod github.com/golang/go/src go1.23 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23 reflect/DeepEqual().(m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).RepeatedBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedBytes., [][]byte{{}})
698 },
699 }, {
700 label: "ListWithEmptyBytes",
701 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedBytes.: nil},
702 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedBytes.: [][]byte{{}}},
703 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
704 return reflectscip-go gomod github.com/golang/go/src go1.23 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23 reflect/DeepEqual().(m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).RepeatedBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedBytes., [][]byte{{}})
705 },
706 }, {
707 label: "ListWithNilMessage",
708 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedNestedMessage.: nil},
709 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{RepeatedNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedNestedMessage.: []*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_NestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#{nil}},
710 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
711 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).RepeatedNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedNestedMessage.[0] != nil
712 },
713 }, {
714 label: "EmptyMap",
715 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringString.: nil},
716 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringString.: map[string]string{}},
717 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
718 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).MapStringStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringString. == nil
719 },
720 }, {
721 label: "MapWithNilBytes",
722 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringBytes.: nil},
723 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringBytes.: map[string][]byte{"k": nil}},
724 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
725 return reflectscip-go gomod github.com/golang/go/src go1.23 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23 reflect/DeepEqual().(m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).MapStringBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringBytes., map[string][]byte{"k": {}})
726 },
727 }, {
728 label: "MapWithEmptyBytes",
729 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringBytes.: nil},
730 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringBytes.: map[string][]byte{"k": {}}},
731 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
732 return reflectscip-go gomod github.com/golang/go/src go1.23 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23 reflect/DeepEqual().(m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).MapStringBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringBytes., map[string][]byte{"k": {}})
733 },
734 }, {
735 label: "MapWithNilMessage",
736 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringNestedMessage.: nil},
737 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{MapStringNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringNestedMessage.: map[string]*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_NestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#{"k": nil}},
738 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
739 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).MapStringNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringNestedMessage.["k"] != nil
740 },
741 }, {
742 label: "OneofWithTypedNilWrapper",
743 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{OneofFieldscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OneofField.: nil},
744 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{OneofFieldscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OneofField.: (*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_OneofNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_OneofNestedMessage#)(nil)},
745 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
746 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).OneofFieldscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OneofField. == nil
747 },
748 }, {
749 label: "OneofWithNilMessage",
750 dst: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{OneofFieldscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OneofField.: nil},
751 src: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{OneofFieldscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OneofField.: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_OneofNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_OneofNestedMessage#{OneofNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_OneofNestedMessage#OneofNestedMessage.: nil}},
752 check: func(m protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) bool {
753 return m.(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#).OneofFieldscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OneofField..(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_OneofNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_OneofNestedMessage#).OneofNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_OneofNestedMessage#OneofNestedMessage. != nil
754 },
755 // TODO: extension, nil message
756 // TODO: repeated extension, nil
757 // TODO: extension bytes
758 // TODO: repeated extension, nil message
759 }}
760
761 for _, tt := range tests {
762 t.Runscip-go gomod github.com/golang/go/src go1.23 testing/T#Run().(tt.label, func(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
763 var pass bool
764 func() {
765 defer func() { recover() }()
766 protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Mergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Merge().(tt.dst, tt.src)
767 pass = tt.check(tt.dst)
768 }()
769 if !pass {
770 t.Errorscip-go gomod github.com/golang/go/src go1.23 testing/common#Error().("check failed")
771 }
772 })
773 }
774 }
775
776 func TestMergeRacescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestMergeRace().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
777 dst := new(testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#)
778 srcs := []*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{
779 {OptionalInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalInt32.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(1)},
780 {OptionalStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalString.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Stringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/String().("hello")},
781 {RepeatedInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedInt32.: []int32{2, 3, 4}},
782 {RepeatedStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedString.: []string{"goodbye"}},
783 {MapStringStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringString.: map[string]string{"key": "value"}},
784 {OptionalNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalNestedMessage.: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_NestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#{
785 Ascip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#A.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(5),
786 }},
787 func() *testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes# {
788 m := new(testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#)
789 m.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#ProtoReflect().().SetUnknownscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#SetUnknown.(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#{
790 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 50000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-5),
791 }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().())
792 return m
793 }(),
794 }
795
796 // It should be safe to concurrently merge non-overlapping fields.
797 var wg syncscip-go gomod github.com/golang/go/src go1.23 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.23 sync/WaitGroup#
798 defer wg.Waitscip-go gomod github.com/golang/go/src go1.23 sync/WaitGroup#Wait().()
799 for _, src := range srcs {
800 wg.Addscip-go gomod github.com/golang/go/src go1.23 sync/WaitGroup#Add().(1)
801 go func(src protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Message#) {
802 defer wg.Donescip-go gomod github.com/golang/go/src go1.23 sync/WaitGroup#Done().()
803 protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Mergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Merge().(dst, src)
804 }(src)
805 }
806 }
807
808 func TestMergeSelfscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestMergeSelf().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
809 got := &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{
810 OptionalInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalInt32.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(1),
811 OptionalStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalString.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Stringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/String().("hello"),
812 RepeatedInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedInt32.: []int32{2, 3, 4},
813 RepeatedStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedString.: []string{"goodbye"},
814 MapStringStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringString.: map[string]string{"key": "value"},
815 OptionalNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalNestedMessage.: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_NestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#{
816 Ascip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#A.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(5),
817 },
818 }
819 got.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#ProtoReflect().().SetUnknownscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#SetUnknown.(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#{
820 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 50000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-5),
821 }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().())
822 protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Mergescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Merge().(got, got)
823
824 // The main impact of merging to self is that repeated fields and
825 // unknown fields are doubled.
826 want := &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{
827 OptionalInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalInt32.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(1),
828 OptionalStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalString.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Stringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/String().("hello"),
829 RepeatedInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedInt32.: []int32{2, 3, 4, 2, 3, 4},
830 RepeatedStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#RepeatedString.: []string{"goodbye", "goodbye"},
831 MapStringStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#MapStringString.: map[string]string{"key": "value"},
832 OptionalNestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalNestedMessage.: &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypes_NestedMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#{
833 Ascip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes_NestedMessage#A.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(5),
834 },
835 }
836 want.ProtoReflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#ProtoReflect().().SetUnknownscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#SetUnknown.(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#{
837 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 50000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-5),
838 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#{Numberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Number.: 50000, Typescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Tag#Type.: 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`/.Svarintscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Svarint#(-5),
839 }.Marshalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/testing/protopack`/Message#Marshal().())
840
841 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(got, want) {
842 t.Errorfscip-go gomod github.com/golang/go/src go1.23 testing/common#Errorf().("Equal mismatch:\ngot %v\nwant %v", got, want)
843 }
844 }
845
846 func TestClonescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestClone().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
847 want := &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{
848 OptionalInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalInt32.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(1),
849 }
850 got := protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Clonescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Clone().(want).(*testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#)
851 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(got, want) {
852 t.Errorfscip-go gomod github.com/golang/go/src go1.23 testing/common#Errorf().("Clone(src) != src:\n got %v\nwant %v", got, want)
853 }
854 }
855
856 func TestCloneOfscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/TestCloneOf().(t *testingscip-go gomod github.com/golang/go/src go1.23 testing/.Tscip-go gomod github.com/golang/go/src go1.23 testing/T#) {
857 want := &testpbscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/.TestAllTypesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#{
858 OptionalInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/internal/testprotos/test`/TestAllTypes#OptionalInt32.: protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Int32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Int32().(1),
859 }
860 got := protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.CloneOfscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/CloneOf().(want)
861 if !protoscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/.Equalscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto`/Equal().(got, want) {
862 t.Errorfscip-go gomod github.com/golang/go/src go1.23 testing/common#Errorf().("Clone(src) != src:\n got %v\nwant %v", got, want)
863 }
864 }
865
866 // mutateValue changes a Value, returning a new value.
867 //
868 // For scalar values, it returns a value different from the input.
869 // For Message, List, and Map values, it mutates the input and returns it.
870 func mutateValuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/mutateValue().(v protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Value#) protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Value# {
871 switch v := v.Interfacescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Value#Interface().().(type) {
872 case bool:
873 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfBoolscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfBool().(!v)
874 case protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.EnumNumberscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/EnumNumber#:
875 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfEnumscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfEnum().(v + 1)
876 case int32:
877 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfInt32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfInt32().(v + 1)
878 case int64:
879 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfInt64scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfInt64().(v + 1)
880 case uint32:
881 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfUint32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfUint32().(v + 1)
882 case uint64:
883 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfUint64scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfUint64().(v + 1)
884 case float32:
885 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfFloat32scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfFloat32().(v + 1)
886 case float64:
887 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfFloat64scip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfFloat64().(v + 1)
888 case []byte:
889 for i := range v {
890 v[i]++
891 }
892 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfBytesscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfBytes().(v)
893 case string:
894 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfStringscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfString().("_" + v)
895 case protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Messagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#:
896 v.Rangescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#Range.(func(fd protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, val protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool {
897 v.Setscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Message#Set.(fd, mutateValuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/mutateValue().(val))
898 return true
899 })
900 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfMessagescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfMessage().(v)
901 case protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Listscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/List#:
902 for i := 0; i < v.Lenscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/List#Len.(); i++ {
903 v.Setscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/List#Set.(i, mutateValuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/mutateValue().(v.Getscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/List#Get.(i)))
904 }
905 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfListscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfList().(v)
906 case protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Mapscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Map#:
907 v.Rangescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Map#Range.(func(mk protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.MapKeyscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/MapKey#, mv protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool {
908 v.Setscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/Map#Set.(mk, mutateValuescip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/proto_test`/mutateValue().(mv))
909 return true
910 })
911 return protoreflectscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/.ValueOfMapscip-go gomod google.golang.org/protobuf . `google.golang.org/protobuf/reflect/protoreflect`/ValueOfMap().(v)
912 default:
913 panic(fmtscip-go gomod github.com/golang/go/src go1.23 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.23 fmt/Sprintf().("unknown value type %T", v))
914 }
915 }