@@ -118,27 +118,18 @@ void main() {
118118 });
119119
120120 test ('can merge extension' , () {
121- final nestedMessage = TestAllTypes_NestedMessage ()..i = 42 ;
122121 final mergeSource =
123- TestAllExtensions ()..setExtension (
124- Unittest .optionalNestedMessageExtension,
125- nestedMessage,
126- );
122+ TestAllExtensions ()..addExtension (Unittest .repeatedInt32Extension, 123 );
127123
128- final nestedMessage2 = TestAllTypes_NestedMessage ()..bb = 43 ;
129124 final mergeDest =
130- TestAllExtensions ()..setExtension (
131- Unittest .optionalNestedMessageExtension,
132- nestedMessage2,
133- );
125+ TestAllExtensions ()..addExtension (Unittest .repeatedInt32Extension, 456 );
134126
135127 final result =
136128 TestAllExtensions ()
137129 ..mergeFromMessage (mergeSource)
138130 ..mergeFromMessage (mergeDest);
139131
140- expect (result.getExtension (Unittest .optionalNestedMessageExtension).i, 42 );
141- expect (result.getExtension (Unittest .optionalNestedMessageExtension).bb, 43 );
132+ expect (result.getExtension (Unittest .repeatedInt32Extension), [123 , 456 ]);
142133 });
143134
144135 test ("throws if field number isn't allowed for extension" , () {
@@ -148,7 +139,7 @@ void main() {
148139 message.setExtension (Unittest .optionalInt32Extension, 0 );
149140 },
150141 throwsArgError (
151- 'Extension optionalInt32Extension not legal for message protobuf_unittest .TestAllTypes' ,
142+ 'Extension optionalInt32Extension not legal for message proto2_unittest .TestAllTypes' ,
152143 ),
153144 );
154145
@@ -157,7 +148,7 @@ void main() {
157148 message.getExtension (Unittest .optionalInt32Extension);
158149 },
159150 throwsArgError (
160- 'Extension optionalInt32Extension not legal for message protobuf_unittest .TestAllTypes' ,
151+ 'Extension optionalInt32Extension not legal for message proto2_unittest .TestAllTypes' ,
161152 ),
162153 );
163154 });
@@ -169,7 +160,7 @@ void main() {
169160 message.setExtension (Unittest .optionalInt32Extension, 'hello' );
170161 },
171162 throwsArgError (
172- 'Illegal to set field optionalInt32Extension (1) of protobuf_unittest .TestAllExtensions'
163+ 'Illegal to set field optionalInt32Extension (1) of proto2_unittest .TestAllExtensions'
173164 ' to value (hello): not type int' ,
174165 ),
175166 );
@@ -182,7 +173,7 @@ void main() {
182173 message.setExtension (Unittest .optionalInt64Extension, 123 );
183174 },
184175 throwsArgError (
185- 'Illegal to set field optionalInt64Extension (2) of protobuf_unittest .TestAllExtensions'
176+ 'Illegal to set field optionalInt64Extension (2) of proto2_unittest .TestAllExtensions'
186177 ' to value (123): not Int64' ,
187178 ),
188179 );
@@ -198,7 +189,7 @@ void main() {
198189 },
199190 throwsArgError (
200191 'Illegal to set field optionalNestedMessageExtension (18)'
201- ' of protobuf_unittest .TestAllExtensions to value (123): not a GeneratedMessage' ,
192+ ' of proto2_unittest .TestAllExtensions to value (123): not a GeneratedMessage' ,
202193 ),
203194 );
204195
@@ -221,7 +212,7 @@ void main() {
221212 },
222213 throwsArgError (
223214 'Illegal to set field optionalNestedEnumExtension (21)'
224- ' of protobuf_unittest .TestAllExtensions to value (123): not type ProtobufEnum' ,
215+ ' of proto2_unittest .TestAllExtensions to value (123): not type ProtobufEnum' ,
225216 ),
226217 );
227218
@@ -272,7 +263,7 @@ void main() {
272263 ..addExtension (Unittest .repeatedStringExtension, 'world' )
273264 ..setExtension (
274265 Unittest .optionalNestedMessageExtension,
275- TestAllTypes_NestedMessage ()..i = 42 ,
266+ TestAllTypes_NestedMessage ()..bb = 42 ,
276267 )
277268 ..setExtension (
278269 Unittest .optionalNestedEnumExtension,
@@ -282,7 +273,7 @@ void main() {
282273 final expected =
283274 '[optionalInt32Extension]: 1\n '
284275 '[optionalNestedMessageExtension]: {\n '
285- ' i : 42\n '
276+ ' bb : 42\n '
286277 '}\n '
287278 '[optionalNestedEnumExtension]: BAR\n '
288279 '[repeatedStringExtension]: hello\n '
@@ -438,8 +429,8 @@ void main() {
438429 test ('ExtensionRegistry.reparseMessage will throw on malformed buffers' , () {
439430 final r = ExtensionRegistry ();
440431 Unittest .registerAllExtensions (r);
441- final r2 = ExtensionRegistry ();
442432
433+ final r2 = ExtensionRegistry ();
443434 Extend_unittest .registerAllExtensions (r2);
444435
445436 // The message encoded in this buffer has an encoding error in the
@@ -709,7 +700,7 @@ void main() {
709700 },
710701 );
711702
712- test ('consistent hashcode for reparsed messages with extensions' , () {
703+ test ('consistent hashCode for reparsed messages with extensions' , () {
713704 final r = ExtensionRegistry ()..add (Extend_unittest .outer);
714705 final m =
715706 TestAllExtensions ()..setExtension (
0 commit comments