Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: test/generated_message_test.dart

Issue 1829573002: Fix all strong mode warnings in protoc-plugin (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: regenerate pb.dart files Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/file_generator_test.dart ('k') | test/message_generator_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 library generated_message_test; 6 library generated_message_test;
7 7
8 import 'package:protobuf/protobuf.dart'; 8 import 'package:protobuf/protobuf.dart';
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 10
11 import '../out/protos/google/protobuf/unittest.pb.dart'; 11 import '../out/protos/google/protobuf/unittest.pb.dart';
12 import '../out/protos/google/protobuf/unittest_import.pb.dart'; 12 import '../out/protos/google/protobuf/unittest_import.pb.dart';
13 import '../out/protos/google/protobuf/unittest_optimize_for.pb.dart'; 13 import '../out/protos/google/protobuf/unittest_optimize_for.pb.dart';
14 import '../out/protos/multiple_files_test.pb.dart'; 14 import '../out/protos/multiple_files_test.pb.dart';
15 import '../out/protos/reserved_names.pb.dart'; 15 import '../out/protos/reserved_names.pb.dart';
16 import '../out/protos/duplicate_names_import.pb.dart'; 16 import '../out/protos/duplicate_names_import.pb.dart';
17 import '../out/protos/package1.pb.dart' as p1; 17 import '../out/protos/package1.pb.dart' as p1;
18 import '../out/protos/package2.pb.dart' as p2; 18 import '../out/protos/package2.pb.dart' as p2;
19 import '../out/protos/package3.pb.dart' as p3; 19 import '../out/protos/package3.pb.dart' as p3;
20 import '../out/protos/toplevel_import.pb.dart' as t; 20 import '../out/protos/toplevel_import.pb.dart' as t;
21 import '../out/protos/toplevel.pb.dart'; 21 import '../out/protos/toplevel.pb.dart';
22 22
23 import 'test_util.dart'; 23 import 'test_util.dart';
24 24
25 void main() { 25 void main() {
26 final throwsInvalidProtocolBufferException = 26 final throwsInvalidProtocolBufferException =
27 throwsA(new isInstanceOf<InvalidProtocolBufferException>()); 27 throwsA(new isInstanceOf<InvalidProtocolBufferException>());
28 test('testProtosShareRepeatedArraysIfDidntChange', () { 28 test('testProtosShareRepeatedArraysIfDidntChange', () {
29 TestAllTypes value1 = new TestAllTypes() 29 TestAllTypes value1 = new TestAllTypes()
30 ..repeatedInt32.add(100) 30 ..repeatedInt32.add(100)
31 ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR) 31 ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR)
32 ..repeatedForeignMessage.add(new ForeignMessage()); 32 ..repeatedForeignMessage.add(new ForeignMessage());
33 33
34 TestAllTypes value2 = value1.clone(); 34 TestAllTypes value2 = value1.clone();
35 35
36 expect(value2.repeatedInt32, value1.repeatedInt32); 36 expect(value2.repeatedInt32, value1.repeatedInt32);
37 expect(value2.repeatedImportEnum, value1.repeatedImportEnum); 37 expect(value2.repeatedImportEnum, value1.repeatedImportEnum);
38 expect(value2.repeatedForeignMessage, value1.repeatedForeignMessage); 38 expect(value2.repeatedForeignMessage, value1.repeatedForeignMessage);
39 }); 39 });
40 40
41 test('testSettersRejectNull', () { 41 test('testSettersRejectNull', () {
42 TestAllTypes message = new TestAllTypes(); 42 TestAllTypes message = new TestAllTypes();
43 expect(() { message.optionalString = null; }, throwsArgumentError); 43 expect(() {
44 expect(() { message.optionalBytes = null; }, throwsArgumentError); 44 message.optionalString = null;
45 expect(() { message.optionalNestedMessage = null; }, throwsArgumentError); 45 }, throwsArgumentError);
46 expect(() { message.optionalNestedMessage =null; }, throwsArgumentError); 46 expect(() {
47 expect(() { message.optionalNestedEnum = null; }, throwsArgumentError); 47 message.optionalBytes = null;
48 expect(() { message.repeatedString.add(null); }, throwsArgumentError); 48 }, throwsArgumentError);
49 expect(() { message.repeatedBytes.add(null); }, throwsArgumentError); 49 expect(() {
50 expect(() { message.repeatedNestedMessage.add(null); }, 50 message.optionalNestedMessage = null;
51 throwsArgumentError); 51 }, throwsArgumentError);
52 expect(() { message.repeatedNestedMessage.add(null); }, 52 expect(() {
53 throwsArgumentError); 53 message.optionalNestedMessage = null;
54 expect(() { message.repeatedNestedEnum.add(null); }, throwsArgumentError); 54 }, throwsArgumentError);
55 expect(() {
56 message.optionalNestedEnum = null;
57 }, throwsArgumentError);
58 expect(() {
59 message.repeatedString.add(null);
60 }, throwsArgumentError);
61 expect(() {
62 message.repeatedBytes.add(null);
63 }, throwsArgumentError);
64 expect(() {
65 message.repeatedNestedMessage.add(null);
66 }, throwsArgumentError);
67 expect(() {
68 message.repeatedNestedMessage.add(null);
69 }, throwsArgumentError);
70 expect(() {
71 message.repeatedNestedEnum.add(null);
72 }, throwsArgumentError);
55 }); 73 });
56 74
57 test('testDefaultMessageIsReadOnly', () { 75 test('testDefaultMessageIsReadOnly', () {
58 var message = new TestAllTypes(); 76 var message = new TestAllTypes();
59 expect(message.optionalNestedMessage, same(TestAllTypes_NestedMessage.getDef ault())); 77 expect(message.optionalNestedMessage,
60 expect(() { message.optionalNestedMessage.bb = 123; }, throwsUnsupportedErro r); 78 same(TestAllTypes_NestedMessage.getDefault()));
79 expect(() {
80 message.optionalNestedMessage.bb = 123;
81 }, throwsUnsupportedError);
61 82
62 message = TestAllTypes.getDefault(); 83 message = TestAllTypes.getDefault();
63 expect(() { message.clear(); }, throwsUnsupportedError); 84 expect(() {
64 expect(() { message.optionalString = "123"; }, throwsUnsupportedError); 85 message.clear();
65 expect(() { message.clearOptionalString(); }, throwsUnsupportedError); 86 }, throwsUnsupportedError);
66 expect(() { message.repeatedString.add("123"); }, throwsUnsupportedError); 87 expect(() {
67 expect(() { message.repeatedString.clear(); }, throwsUnsupportedError); 88 message.optionalString = "123";
68 expect(() { message.unknownFields.clear(); }, throwsUnsupportedError); 89 }, throwsUnsupportedError);
90 expect(() {
91 message.clearOptionalString();
92 }, throwsUnsupportedError);
93 expect(() {
94 message.repeatedString.add("123");
95 }, throwsUnsupportedError);
96 expect(() {
97 message.repeatedString.clear();
98 }, throwsUnsupportedError);
99 expect(() {
100 message.unknownFields.clear();
101 }, throwsUnsupportedError);
69 }); 102 });
70 103
71 test('testRepeatedSetters', () { 104 test('testRepeatedSetters', () {
72 TestAllTypes message = getAllSet(); 105 TestAllTypes message = getAllSet();
73 modifyRepeatedFields(message); 106 modifyRepeatedFields(message);
74 assertRepeatedFieldsModified(message); 107 assertRepeatedFieldsModified(message);
75 }); 108 });
76 109
77 test('testRepeatedSettersRejectNull', () { 110 test('testRepeatedSettersRejectNull', () {
78 TestAllTypes message = new TestAllTypes(); 111 TestAllTypes message = new TestAllTypes();
79 112
80 message.repeatedString.addAll(['one', 'two']); 113 message.repeatedString.addAll(['one', 'two']);
81 expect(() { message.repeatedString[1] = null; }, throwsArgumentError); 114 expect(() {
115 message.repeatedString[1] = null;
116 }, throwsArgumentError);
82 117
83 message.repeatedBytes.addAll(['one'.codeUnits, 'two'.codeUnits]); 118 message.repeatedBytes.addAll(['one'.codeUnits, 'two'.codeUnits]);
84 expect(() { message.repeatedBytes[1] = null; }, throwsArgumentError); 119 expect(() {
120 message.repeatedBytes[1] = null;
121 }, throwsArgumentError);
85 122
86 message.repeatedNestedMessage.addAll([ 123 message.repeatedNestedMessage.addAll([
87 new TestAllTypes_NestedMessage()..bb = 318, 124 new TestAllTypes_NestedMessage()..bb = 318,
88 new TestAllTypes_NestedMessage()..bb = 456]); 125 new TestAllTypes_NestedMessage()..bb = 456
89 expect(() { message.repeatedNestedMessage[1] = null; }, 126 ]);
90 throwsArgumentError); 127 expect(() {
128 message.repeatedNestedMessage[1] = null;
129 }, throwsArgumentError);
91 130
92 message.repeatedNestedEnum.addAll( 131 message.repeatedNestedEnum
93 [TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAR]); 132 .addAll([TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAR]);
94 expect(() { message.repeatedNestedEnum[1] = null; }, 133 expect(() {
95 throwsArgumentError); 134 message.repeatedNestedEnum[1] = null;
135 }, throwsArgumentError);
96 }); 136 });
97 137
98 test('testRepeatedAppend', () { 138 test('testRepeatedAppend', () {
99 TestAllTypes message = new TestAllTypes() 139 TestAllTypes message = new TestAllTypes()
100 ..repeatedInt32.addAll([1, 2, 3, 4]) 140 ..repeatedInt32.addAll([1, 2, 3, 4])
101 ..repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ]) 141 ..repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ])
102 ..repeatedForeignMessage.addAll([new ForeignMessage()..c = 12]); 142 ..repeatedForeignMessage.addAll([new ForeignMessage()..c = 12]);
103 143
104 expect(message.repeatedInt32, [1, 2, 3, 4]); 144 expect(message.repeatedInt32, [1, 2, 3, 4]);
105 expect(message.repeatedForeignEnum, [ForeignEnum.FOREIGN_BAZ]); 145 expect(message.repeatedForeignEnum, [ForeignEnum.FOREIGN_BAZ]);
106 expect(message.repeatedForeignMessage.length, 1); 146 expect(message.repeatedForeignMessage.length, 1);
107 expect(message.repeatedForeignMessage[0].c, 12); 147 expect(message.repeatedForeignMessage[0].c, 12);
108 }); 148 });
109 149
110 test('testRepeatedAppendRejectsNull', () { 150 test('testRepeatedAppendRejectsNull', () {
111 TestAllTypes message = new TestAllTypes(); 151 TestAllTypes message = new TestAllTypes();
112 152
113 expect(() { 153 expect(() {
114 message.repeatedForeignMessage.addAll([ 154 message.repeatedForeignMessage
115 new ForeignMessage()..c = 12, null]); }, throwsArgumentError); 155 .addAll([new ForeignMessage()..c = 12, null]);
156 }, throwsArgumentError);
116 157
117 expect(() { 158 expect(() {
118 message.repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ, null]); 159 message.repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ, null]);
119 }, throwsArgumentError); 160 }, throwsArgumentError);
120 161
121 expect(() { message.repeatedString.addAll(['one', null]); }, 162 expect(() {
122 throwsArgumentError); 163 message.repeatedString.addAll(['one', null]);
164 }, throwsArgumentError);
123 165
124 expect(() { message.repeatedBytes.addAll(['one'.codeUnits, null]); }, 166 expect(() {
125 throwsArgumentError); 167 message.repeatedBytes.addAll(['one'.codeUnits, null]);
168 }, throwsArgumentError);
126 }); 169 });
127 170
128 test('testSettingForeignMessage', () { 171 test('testSettingForeignMessage', () {
129 TestAllTypes message = new TestAllTypes() 172 TestAllTypes message = new TestAllTypes()
130 ..optionalForeignMessage = (new ForeignMessage()..c = 123); 173 ..optionalForeignMessage = (new ForeignMessage()..c = 123);
131 174
132 TestAllTypes expectedMessage = new TestAllTypes() 175 TestAllTypes expectedMessage = new TestAllTypes()
133 ..optionalForeignMessage = (new ForeignMessage()..c = 123); 176 ..optionalForeignMessage = (new ForeignMessage()..c = 123);
134 177
135 expect(message, expectedMessage); 178 expect(message, expectedMessage);
136 }); 179 });
137 180
138 test('testSettingRepeatedForeignMessage', () { 181 test('testSettingRepeatedForeignMessage', () {
139 TestAllTypes message = new TestAllTypes() 182 TestAllTypes message = new TestAllTypes()
140 ..repeatedForeignMessage.add(new ForeignMessage()..c = 456); 183 ..repeatedForeignMessage.add(new ForeignMessage()..c = 456);
141 184
142 TestAllTypes expectedMessage = new TestAllTypes() 185 TestAllTypes expectedMessage = new TestAllTypes()
143 ..repeatedForeignMessage.add(new ForeignMessage()..c = 456); 186 ..repeatedForeignMessage.add(new ForeignMessage()..c = 456);
144 187
145 expect(message, expectedMessage); 188 expect(message, expectedMessage);
146 }); 189 });
147 190
148 test('testDefaults', () { 191 test('testDefaults', () {
149 assertClear(new TestAllTypes()); 192 assertClear(new TestAllTypes());
150 193
151 TestExtremeDefaultValues message = 194 TestExtremeDefaultValues message = new TestExtremeDefaultValues();
152 new TestExtremeDefaultValues();
153 195
154 expect(message.utf8String, '\u1234'); 196 expect(message.utf8String, '\u1234');
155 expect(message.infDouble, same(double.INFINITY)); 197 expect(message.infDouble, same(double.INFINITY));
156 expect(message.negInfDouble, same(double.NEGATIVE_INFINITY)); 198 expect(message.negInfDouble, same(double.NEGATIVE_INFINITY));
157 expect(message.nanDouble, same(double.NAN)); 199 expect(message.nanDouble, same(double.NAN));
158 expect(message.infFloat, same(double.INFINITY)); 200 expect(message.infFloat, same(double.INFINITY));
159 expect(message.negInfFloat, same(double.NEGATIVE_INFINITY)); 201 expect(message.negInfFloat, same(double.NEGATIVE_INFINITY));
160 expect(message.nanFloat, same(double.NAN)); 202 expect(message.nanFloat, same(double.NAN));
161 expect(message.cppTrigraph, '? ? ?? ?? ??? ??/ ??-'); 203 expect(message.cppTrigraph, '? ? ?? ?? ??? ??/ ??-');
162 expect(message.smallInt64.toRadixString(16).toUpperCase(), 204 expect(message.smallInt64.toRadixString(16).toUpperCase(),
(...skipping 10 matching lines...) Expand all
173 }); 215 });
174 216
175 // void testReflectionGetters() {} // UNSUPPORTED -- until reflection 217 // void testReflectionGetters() {} // UNSUPPORTED -- until reflection
176 // void testReflectionSetters() {} // UNSUPPORTED -- until reflection 218 // void testReflectionSetters() {} // UNSUPPORTED -- until reflection
177 // void testReflectionSettersRejectNull() {} // UNSUPPORTED - reflection 219 // void testReflectionSettersRejectNull() {} // UNSUPPORTED - reflection
178 // void testReflectionRepeatedSetters() {} // UNSUPPORTED -- reflection 220 // void testReflectionRepeatedSetters() {} // UNSUPPORTED -- reflection
179 // void testReflectionRepeatedSettersRejectNull() {} // UNSUPPORTED 221 // void testReflectionRepeatedSettersRejectNull() {} // UNSUPPORTED
180 // void testReflectionDefaults() {} // UNSUPPORTED -- until reflection 222 // void testReflectionDefaults() {} // UNSUPPORTED -- until reflection
181 223
182 test('testEnumInterface', () { 224 test('testEnumInterface', () {
183 expect(new TestAllTypes().defaultNestedEnum, 225 expect(
184 new isInstanceOf<ProtobufEnum>()); 226 new TestAllTypes().defaultNestedEnum, new isInstanceOf<ProtobufEnum>());
185 }); 227 });
186 228
187 test('testEnumMap', () { 229 test('testEnumMap', () {
188 for (ForeignEnum value in ForeignEnum.values) { 230 for (ForeignEnum value in ForeignEnum.values) {
189 expect(ForeignEnum.valueOf(value.value), value); 231 expect(ForeignEnum.valueOf(value.value), value);
190 } 232 }
191 expect(ForeignEnum.valueOf(12345), isNull); 233 expect(ForeignEnum.valueOf(12345), isNull);
192 }); 234 });
193 235
194 test('testParsePackedToUnpacked', () { 236 test('testParsePackedToUnpacked', () {
195 TestUnpackedTypes message = 237 TestUnpackedTypes message =
196 new TestUnpackedTypes.fromBuffer(getPackedSet().writeToBuffer()); 238 new TestUnpackedTypes.fromBuffer(getPackedSet().writeToBuffer());
197 assertUnpackedFieldsSet(message); 239 assertUnpackedFieldsSet(message);
198 }); 240 });
199 241
200 test('testParseUnpackedToPacked', () { 242 test('testParseUnpackedToPacked', () {
201 TestPackedTypes message = 243 TestPackedTypes message =
202 new TestPackedTypes.fromBuffer(getUnpackedSet().writeToBuffer()); 244 new TestPackedTypes.fromBuffer(getUnpackedSet().writeToBuffer());
203 assertPackedFieldsSet(message); 245 assertPackedFieldsSet(message);
204 }); 246 });
205 247
206 test('testIgnoreJavaMultipleFilesOption', () { // UNSUPPORTED getFile 248 test('testIgnoreJavaMultipleFilesOption', () {
249 // UNSUPPORTED getFile
207 // We mostly just want to check that things compile. 250 // We mostly just want to check that things compile.
208 MessageWithNoOuter message = new MessageWithNoOuter() 251 MessageWithNoOuter message = new MessageWithNoOuter()
209 ..nested = (new MessageWithNoOuter_NestedMessage()..i = 1) 252 ..nested = (new MessageWithNoOuter_NestedMessage()..i = 1)
210 ..foreign.add(new TestAllTypes()..optionalInt32 = 1) 253 ..foreign.add(new TestAllTypes()..optionalInt32 = 1)
211 ..nestedEnum = MessageWithNoOuter_NestedEnum.BAZ 254 ..nestedEnum = MessageWithNoOuter_NestedEnum.BAZ
212 ..foreignEnum = EnumWithNoOuter.BAR; 255 ..foreignEnum = EnumWithNoOuter.BAR;
213 256
214 expect(new MessageWithNoOuter.fromBuffer(message.writeToBuffer()), message); 257 expect(new MessageWithNoOuter.fromBuffer(message.writeToBuffer()), message);
215 258
216 // Not currently supported in Dart protobuf. 259 // Not currently supported in Dart protobuf.
217 // expect(MessageWithNoOuter.getDescriptor().getFile(), 260 // expect(MessageWithNoOuter.getDescriptor().getFile(),
218 // MultipleFilesTestProto.getDescriptor()); 261 // MultipleFilesTestProto.getDescriptor());
219 262
220 int tagNumber = message.getTagNumber('foreignEnum'); 263 int tagNumber = message.getTagNumber('foreignEnum');
221 expect(tagNumber, isNotNull); 264 expect(tagNumber, isNotNull);
222 expect(message.getField(tagNumber), EnumWithNoOuter.BAR); 265 expect(message.getField(tagNumber), EnumWithNoOuter.BAR);
223 266
224 // Not currently supported in Dart protobuf. 267 // Not currently supported in Dart protobuf.
225 // expect(ServiceWithNoOuter.getDescriptor().getFile() 268 // expect(ServiceWithNoOuter.getDescriptor().getFile()
226 // MultipleFilesTestProto.getDescriptor()); 269 // MultipleFilesTestProto.getDescriptor());
227 270
228 expect(new TestAllExtensions().hasExtension( 271 expect(
229 Multiple_files_test.extensionWithOuter), isFalse); 272 new TestAllExtensions()
273 .hasExtension(Multiple_files_test.extensionWithOuter),
274 isFalse);
230 }); 275 });
231 276
232 test('testOptionalFieldWithRequiredSubfieldsOptimizedForSize', () { 277 test('testOptionalFieldWithRequiredSubfieldsOptimizedForSize', () {
233 expect(new TestOptionalOptimizedForSize().isInitialized(), isTrue); 278 expect(new TestOptionalOptimizedForSize().isInitialized(), isTrue);
234 279
235 expect((new TestOptionalOptimizedForSize() 280 expect(
236 ..o = new TestRequiredOptimizedForSize()).isInitialized(), 281 (new TestOptionalOptimizedForSize()
282 ..o = new TestRequiredOptimizedForSize())
283 .isInitialized(),
237 isFalse); 284 isFalse);
238 285
239 expect((new TestOptionalOptimizedForSize() 286 expect(
240 ..o = (new TestRequiredOptimizedForSize()..x = 5)).isInitialized(), 287 (new TestOptionalOptimizedForSize()
288 ..o = (new TestRequiredOptimizedForSize()..x = 5))
289 .isInitialized(),
241 isTrue); 290 isTrue);
242 }); 291 });
243 292
244 test('testSetAllFieldsAndClone', () { 293 test('testSetAllFieldsAndClone', () {
245 TestAllTypes message = getAllSet(); 294 TestAllTypes message = getAllSet();
246 assertAllFieldsSet(message); 295 assertAllFieldsSet(message);
247 assertAllFieldsSet(message.clone()); 296 assertAllFieldsSet(message.clone());
248 }); 297 });
249 298
250 test('testReadWholeMessage', () { 299 test('testReadWholeMessage', () {
(...skipping 18 matching lines...) Expand all
269 expect(message2.optionalBytes, message.optionalBytes); 318 expect(message2.optionalBytes, message.optionalBytes);
270 }); 319 });
271 320
272 test('testRecursiveMessageDefaultInstance', () { 321 test('testRecursiveMessageDefaultInstance', () {
273 TestRecursiveMessage message = new TestRecursiveMessage(); 322 TestRecursiveMessage message = new TestRecursiveMessage();
274 expect(message.a, isNotNull); 323 expect(message.a, isNotNull);
275 expect(message, message.a); 324 expect(message, message.a);
276 }); 325 });
277 326
278 test('testMaliciousRecursion', () { 327 test('testMaliciousRecursion', () {
279 _makeRecursiveMessage(int depth) { 328 GeneratedMessage _makeRecursiveMessage(int depth) {
280 return depth == 0 ? 329 return depth == 0
281 (new TestRecursiveMessage()..i = 5) : 330 ? (new TestRecursiveMessage()..i = 5)
282 (new TestRecursiveMessage()..a = _makeRecursiveMessage(depth - 1)); 331 : (new TestRecursiveMessage()..a = _makeRecursiveMessage(depth - 1));
283 } 332 }
284 333
285 _assertMessageDepth(TestRecursiveMessage message, int depth) { 334 _assertMessageDepth(TestRecursiveMessage message, int depth) {
286 if (depth == 0) { 335 if (depth == 0) {
287 expect(message.hasA(), isFalse); 336 expect(message.hasA(), isFalse);
288 expect(message.i, 5); 337 expect(message.i, 5);
289 } else { 338 } else {
290 expect(message.hasA(), isTrue); 339 expect(message.hasA(), isTrue);
291 _assertMessageDepth(message.a, depth - 1); 340 _assertMessageDepth(message.a, depth - 1);
292 } 341 }
293 } 342 }
294 343
295 List<int> data64 = _makeRecursiveMessage(64).writeToBuffer(); 344 List<int> data64 = _makeRecursiveMessage(64).writeToBuffer();
296 List<int> data65 = _makeRecursiveMessage(65).writeToBuffer(); 345 List<int> data65 = _makeRecursiveMessage(65).writeToBuffer();
297 346
298 _assertMessageDepth(new TestRecursiveMessage.fromBuffer(data64), 64); 347 _assertMessageDepth(new TestRecursiveMessage.fromBuffer(data64), 64);
299 348
300 expect(() { new TestRecursiveMessage.fromBuffer(data65); }, 349 expect(() {
301 throwsInvalidProtocolBufferException); 350 new TestRecursiveMessage.fromBuffer(data65);
351 }, throwsInvalidProtocolBufferException);
302 352
303 CodedBufferReader input = new CodedBufferReader(data64, recursionLimit: 8); 353 CodedBufferReader input = new CodedBufferReader(data64, recursionLimit: 8);
304 expect(() { 354 expect(() {
305 // Uncomfortable alternative to below... 355 // Uncomfortable alternative to below...
306 new TestRecursiveMessage().mergeFromCodedBufferReader(input); 356 new TestRecursiveMessage().mergeFromCodedBufferReader(input);
307 }, throwsInvalidProtocolBufferException); 357 }, throwsInvalidProtocolBufferException);
308 }); 358 });
309 359
310 test('testSizeLimit', () { 360 test('testSizeLimit', () {
311 CodedBufferReader input = new CodedBufferReader( 361 CodedBufferReader input =
312 getAllSet().writeToBuffer(), sizeLimit: 16); 362 new CodedBufferReader(getAllSet().writeToBuffer(), sizeLimit: 16);
313 363
314 expect(() { 364 expect(() {
315 // Uncomfortable alternative to below... 365 // Uncomfortable alternative to below...
316 new TestAllTypes().mergeFromCodedBufferReader(input); 366 new TestAllTypes().mergeFromCodedBufferReader(input);
317 }, throwsInvalidProtocolBufferException); 367 }, throwsInvalidProtocolBufferException);
318 }); 368 });
319 test('testSerialize', () { 369 test('testSerialize', () {
320 TestAllTypes expected = getAllSet(); 370 TestAllTypes expected = getAllSet();
321 List<int> out = expected.writeToBuffer(); 371 List<int> out = expected.writeToBuffer();
322 TestAllTypes actual = new TestAllTypes.fromBuffer(out); 372 TestAllTypes actual = new TestAllTypes.fromBuffer(out);
323 expect(actual, expected); 373 expect(actual, expected);
324 }); 374 });
325 375
326 test('testEnumValues', () { 376 test('testEnumValues', () {
327 expect(TestAllTypes_NestedEnum.values, 377 expect(TestAllTypes_NestedEnum.values, [
328 [ TestAllTypes_NestedEnum.FOO, 378 TestAllTypes_NestedEnum.FOO,
329 TestAllTypes_NestedEnum.BAR, 379 TestAllTypes_NestedEnum.BAR,
330 TestAllTypes_NestedEnum.BAZ]); 380 TestAllTypes_NestedEnum.BAZ
381 ]);
331 expect(TestAllTypes_NestedEnum.FOO.value, 1); 382 expect(TestAllTypes_NestedEnum.FOO.value, 1);
332 expect(TestAllTypes_NestedEnum.BAR.value, 2); 383 expect(TestAllTypes_NestedEnum.BAR.value, 2);
333 expect(TestAllTypes_NestedEnum.BAZ.value, 3); 384 expect(TestAllTypes_NestedEnum.BAZ.value, 3);
334 }); 385 });
335 386
336 test('testWriteWholeMessage', () { 387 test('testWriteWholeMessage', () {
337 List<int> goldenMessage = const <int>[ 388 List<int> goldenMessage = const <int>[
338 0x08, 0x65, 0x10, 0x66, 0x18, 0x67, 0x20, 0x68, 0x28, 0xd2, 0x01, 0x30, 389 0x08,
339 0xd4, 0x01, 0x3d, 0x6b, 0x00, 0x00, 0x00, 0x41, 0x6c, 0x00, 0x00, 0x00, 390 0x65,
340 0x00, 0x00, 0x00, 0x00, 0x4d, 0x6d, 0x00, 0x00, 0x00, 0x51, 0x6e, 0x00, 391 0x10,
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0xde, 0x42, 0x61, 392 0x66,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x40, 0x68, 0x01, 0x72, 0x03, 393 0x18,
343 0x31, 0x31, 0x35, 0x7a, 0x03, 0x31, 0x31, 0x36, 0x83, 0x01, 0x88, 0x01, 394 0x67,
344 0x75, 0x84, 0x01, 0x92, 0x01, 0x02, 0x08, 0x76, 0x9a, 0x01, 0x02, 0x08, 395 0x20,
345 0x77, 0xa2, 0x01, 0x02, 0x08, 0x78, 0xa8, 0x01, 0x03, 0xb0, 0x01, 0x06, 396 0x68,
346 0xb8, 0x01, 0x09, 0xc2, 0x01, 0x03, 0x31, 0x32, 0x34, 0xca, 0x01, 0x03, 397 0x28,
347 0x31, 0x32, 0x35, 0xf8, 0x01, 0xc9, 0x01, 0xf8, 0x01, 0xad, 0x02, 0x80, 398 0xd2,
348 0x02, 0xca, 0x01, 0x80, 0x02, 0xae, 0x02, 0x88, 0x02, 0xcb, 0x01, 0x88, 399 0x01,
349 0x02, 0xaf, 0x02, 0x90, 0x02, 0xcc, 0x01, 0x90, 0x02, 0xb0, 0x02, 0x98, 400 0x30,
350 0x02, 0x9a, 0x03, 0x98, 0x02, 0xe2, 0x04, 0xa0, 0x02, 0x9c, 0x03, 0xa0, 401 0xd4,
351 0x02, 0xe4, 0x04, 0xad, 0x02, 0xcf, 0x00, 0x00, 0x00, 0xad, 0x02, 0x33, 402 0x01,
352 0x01, 0x00, 0x00, 0xb1, 0x02, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 403 0x3d,
353 0x00, 0xb1, 0x02, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 404 0x6b,
354 0x02, 0xd1, 0x00, 0x00, 0x00, 0xbd, 0x02, 0x35, 0x01, 0x00, 0x00, 0xc1, 405 0x00,
355 0x02, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x02, 0x36, 406 0x00,
356 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0x02, 0x00, 0x00, 0x53, 407 0x00,
357 0x43, 0xcd, 0x02, 0x00, 0x80, 0x9b, 0x43, 0xd1, 0x02, 0x00, 0x00, 0x00, 408 0x41,
358 0x00, 0x00, 0x80, 0x6a, 0x40, 0xd1, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 409 0x6c,
359 0x80, 0x73, 0x40, 0xd8, 0x02, 0x01, 0xd8, 0x02, 0x00, 0xe2, 0x02, 0x03, 410 0x00,
360 0x32, 0x31, 0x35, 0xe2, 0x02, 0x03, 0x33, 0x31, 0x35, 0xea, 0x02, 0x03, 411 0x00,
361 0x32, 0x31, 0x36, 0xea, 0x02, 0x03, 0x33, 0x31, 0x36, 0xf3, 0x02, 0xf8, 412 0x00,
362 0x02, 0xd9, 0x01, 0xf4, 0x02, 0xf3, 0x02, 0xf8, 0x02, 0xbd, 0x02, 0xf4, 413 0x00,
363 0x02, 0x82, 0x03, 0x03, 0x08, 0xda, 0x01, 0x82, 0x03, 0x03, 0x08, 0xbe, 414 0x00,
364 0x02, 0x8a, 0x03, 0x03, 0x08, 0xdb, 0x01, 0x8a, 0x03, 0x03, 0x08, 0xbf, 415 0x00,
365 0x02, 0x92, 0x03, 0x03, 0x08, 0xdc, 0x01, 0x92, 0x03, 0x03, 0x08, 0xc0, 416 0x00,
366 0x02, 0x98, 0x03, 0x02, 0x98, 0x03, 0x03, 0xa0, 0x03, 0x05, 0xa0, 0x03, 417 0x4d,
367 0x06, 0xa8, 0x03, 0x08, 0xa8, 0x03, 0x09, 0xb2, 0x03, 0x03, 0x32, 0x32, 418 0x6d,
368 0x34, 0xb2, 0x03, 0x03, 0x33, 0x32, 0x34, 0xba, 0x03, 0x03, 0x32, 0x32, 419 0x00,
369 0x35, 0xba, 0x03, 0x03, 0x33, 0x32, 0x35, 0xe8, 0x03, 0x91, 0x03, 0xf0, 420 0x00,
370 0x03, 0x92, 0x03, 0xf8, 0x03, 0x93, 0x03, 0x80, 0x04, 0x94, 0x03, 0x88, 421 0x00,
371 0x04, 0xaa, 0x06, 0x90, 0x04, 0xac, 0x06, 0x9d, 0x04, 0x97, 0x01, 0x00, 422 0x51,
372 0x00, 0xa1, 0x04, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 423 0x6e,
373 0x04, 0x99, 0x01, 0x00, 0x00, 0xb1, 0x04, 0x9a, 0x01, 0x00, 0x00, 0x00, 424 0x00,
374 0x00, 0x00, 0x00, 0xbd, 0x04, 0x00, 0x80, 0xcd, 0x43, 0xc1, 0x04, 0x00, 425 0x00,
375 0x00, 0x00, 0x00, 0x00, 0xc0, 0x79, 0x40, 0xc8, 0x04, 0x00, 0xd2, 0x04, 426 0x00,
376 0x03, 0x34, 0x31, 0x35, 0xda, 0x04, 0x03, 0x34, 0x31, 0x36, 0x88, 0x05, 427 0x00,
377 0x01, 0x90, 0x05, 0x04, 0x98, 0x05, 0x07, 0xa2, 0x05, 0x03, 0x34, 0x32, 428 0x00,
378 0x34, 0xaa, 0x05, 0x03, 0x34, 0x32, 0x35 429 0x00,
430 0x00,
431 0x5d,
432 0x00,
433 0x00,
434 0xde,
435 0x42,
436 0x61,
437 0x00,
438 0x00,
439 0x00,
440 0x00,
441 0x00,
442 0x00,
443 0x5c,
444 0x40,
445 0x68,
446 0x01,
447 0x72,
448 0x03,
449 0x31,
450 0x31,
451 0x35,
452 0x7a,
453 0x03,
454 0x31,
455 0x31,
456 0x36,
457 0x83,
458 0x01,
459 0x88,
460 0x01,
461 0x75,
462 0x84,
463 0x01,
464 0x92,
465 0x01,
466 0x02,
467 0x08,
468 0x76,
469 0x9a,
470 0x01,
471 0x02,
472 0x08,
473 0x77,
474 0xa2,
475 0x01,
476 0x02,
477 0x08,
478 0x78,
479 0xa8,
480 0x01,
481 0x03,
482 0xb0,
483 0x01,
484 0x06,
485 0xb8,
486 0x01,
487 0x09,
488 0xc2,
489 0x01,
490 0x03,
491 0x31,
492 0x32,
493 0x34,
494 0xca,
495 0x01,
496 0x03,
497 0x31,
498 0x32,
499 0x35,
500 0xf8,
501 0x01,
502 0xc9,
503 0x01,
504 0xf8,
505 0x01,
506 0xad,
507 0x02,
508 0x80,
509 0x02,
510 0xca,
511 0x01,
512 0x80,
513 0x02,
514 0xae,
515 0x02,
516 0x88,
517 0x02,
518 0xcb,
519 0x01,
520 0x88,
521 0x02,
522 0xaf,
523 0x02,
524 0x90,
525 0x02,
526 0xcc,
527 0x01,
528 0x90,
529 0x02,
530 0xb0,
531 0x02,
532 0x98,
533 0x02,
534 0x9a,
535 0x03,
536 0x98,
537 0x02,
538 0xe2,
539 0x04,
540 0xa0,
541 0x02,
542 0x9c,
543 0x03,
544 0xa0,
545 0x02,
546 0xe4,
547 0x04,
548 0xad,
549 0x02,
550 0xcf,
551 0x00,
552 0x00,
553 0x00,
554 0xad,
555 0x02,
556 0x33,
557 0x01,
558 0x00,
559 0x00,
560 0xb1,
561 0x02,
562 0xd0,
563 0x00,
564 0x00,
565 0x00,
566 0x00,
567 0x00,
568 0x00,
569 0x00,
570 0xb1,
571 0x02,
572 0x34,
573 0x01,
574 0x00,
575 0x00,
576 0x00,
577 0x00,
578 0x00,
579 0x00,
580 0xbd,
581 0x02,
582 0xd1,
583 0x00,
584 0x00,
585 0x00,
586 0xbd,
587 0x02,
588 0x35,
589 0x01,
590 0x00,
591 0x00,
592 0xc1,
593 0x02,
594 0xd2,
595 0x00,
596 0x00,
597 0x00,
598 0x00,
599 0x00,
600 0x00,
601 0x00,
602 0xc1,
603 0x02,
604 0x36,
605 0x01,
606 0x00,
607 0x00,
608 0x00,
609 0x00,
610 0x00,
611 0x00,
612 0xcd,
613 0x02,
614 0x00,
615 0x00,
616 0x53,
617 0x43,
618 0xcd,
619 0x02,
620 0x00,
621 0x80,
622 0x9b,
623 0x43,
624 0xd1,
625 0x02,
626 0x00,
627 0x00,
628 0x00,
629 0x00,
630 0x00,
631 0x80,
632 0x6a,
633 0x40,
634 0xd1,
635 0x02,
636 0x00,
637 0x00,
638 0x00,
639 0x00,
640 0x00,
641 0x80,
642 0x73,
643 0x40,
644 0xd8,
645 0x02,
646 0x01,
647 0xd8,
648 0x02,
649 0x00,
650 0xe2,
651 0x02,
652 0x03,
653 0x32,
654 0x31,
655 0x35,
656 0xe2,
657 0x02,
658 0x03,
659 0x33,
660 0x31,
661 0x35,
662 0xea,
663 0x02,
664 0x03,
665 0x32,
666 0x31,
667 0x36,
668 0xea,
669 0x02,
670 0x03,
671 0x33,
672 0x31,
673 0x36,
674 0xf3,
675 0x02,
676 0xf8,
677 0x02,
678 0xd9,
679 0x01,
680 0xf4,
681 0x02,
682 0xf3,
683 0x02,
684 0xf8,
685 0x02,
686 0xbd,
687 0x02,
688 0xf4,
689 0x02,
690 0x82,
691 0x03,
692 0x03,
693 0x08,
694 0xda,
695 0x01,
696 0x82,
697 0x03,
698 0x03,
699 0x08,
700 0xbe,
701 0x02,
702 0x8a,
703 0x03,
704 0x03,
705 0x08,
706 0xdb,
707 0x01,
708 0x8a,
709 0x03,
710 0x03,
711 0x08,
712 0xbf,
713 0x02,
714 0x92,
715 0x03,
716 0x03,
717 0x08,
718 0xdc,
719 0x01,
720 0x92,
721 0x03,
722 0x03,
723 0x08,
724 0xc0,
725 0x02,
726 0x98,
727 0x03,
728 0x02,
729 0x98,
730 0x03,
731 0x03,
732 0xa0,
733 0x03,
734 0x05,
735 0xa0,
736 0x03,
737 0x06,
738 0xa8,
739 0x03,
740 0x08,
741 0xa8,
742 0x03,
743 0x09,
744 0xb2,
745 0x03,
746 0x03,
747 0x32,
748 0x32,
749 0x34,
750 0xb2,
751 0x03,
752 0x03,
753 0x33,
754 0x32,
755 0x34,
756 0xba,
757 0x03,
758 0x03,
759 0x32,
760 0x32,
761 0x35,
762 0xba,
763 0x03,
764 0x03,
765 0x33,
766 0x32,
767 0x35,
768 0xe8,
769 0x03,
770 0x91,
771 0x03,
772 0xf0,
773 0x03,
774 0x92,
775 0x03,
776 0xf8,
777 0x03,
778 0x93,
779 0x03,
780 0x80,
781 0x04,
782 0x94,
783 0x03,
784 0x88,
785 0x04,
786 0xaa,
787 0x06,
788 0x90,
789 0x04,
790 0xac,
791 0x06,
792 0x9d,
793 0x04,
794 0x97,
795 0x01,
796 0x00,
797 0x00,
798 0xa1,
799 0x04,
800 0x98,
801 0x01,
802 0x00,
803 0x00,
804 0x00,
805 0x00,
806 0x00,
807 0x00,
808 0xad,
809 0x04,
810 0x99,
811 0x01,
812 0x00,
813 0x00,
814 0xb1,
815 0x04,
816 0x9a,
817 0x01,
818 0x00,
819 0x00,
820 0x00,
821 0x00,
822 0x00,
823 0x00,
824 0xbd,
825 0x04,
826 0x00,
827 0x80,
828 0xcd,
829 0x43,
830 0xc1,
831 0x04,
832 0x00,
833 0x00,
834 0x00,
835 0x00,
836 0x00,
837 0xc0,
838 0x79,
839 0x40,
840 0xc8,
841 0x04,
842 0x00,
843 0xd2,
844 0x04,
845 0x03,
846 0x34,
847 0x31,
848 0x35,
849 0xda,
850 0x04,
851 0x03,
852 0x34,
853 0x31,
854 0x36,
855 0x88,
856 0x05,
857 0x01,
858 0x90,
859 0x05,
860 0x04,
861 0x98,
862 0x05,
863 0x07,
864 0xa2,
865 0x05,
866 0x03,
867 0x34,
868 0x32,
869 0x34,
870 0xaa,
871 0x05,
872 0x03,
873 0x34,
874 0x32,
875 0x35
379 ]; 876 ];
380 expect(getAllSet().writeToBuffer(), goldenMessage); 877 expect(getAllSet().writeToBuffer(), goldenMessage);
381 }); 878 });
382 879
383 test('testWriteWholePackedFieldsMessage', () { 880 test('testWriteWholePackedFieldsMessage', () {
384 List<int> goldenPackedMessage = const <int>[ 881 List<int> goldenPackedMessage = const <int>[
385 0xd2, 0x05, 0x04, 0xd9, 0x04, 0xbd, 0x05, 0xda, 0x05, 0x04, 0xda, 0x04, 882 0xd2,
386 0xbe, 0x05, 0xe2, 0x05, 0x04, 0xdb, 0x04, 0xbf, 0x05, 0xea, 0x05, 0x04, 883 0x05,
387 0xdc, 0x04, 0xc0, 0x05, 0xf2, 0x05, 0x04, 0xba, 0x09, 0x82, 0x0b, 0xfa, 884 0x04,
388 0x05, 0x04, 0xbc, 0x09, 0x84, 0x0b, 0x82, 0x06, 0x08, 0x5f, 0x02, 0x00, 885 0xd9,
389 0x00, 0xc3, 0x02, 0x00, 0x00, 0x8a, 0x06, 0x10, 0x60, 0x02, 0x00, 0x00, 886 0x04,
390 0x00, 0x00, 0x00, 0x00, 0xc4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 887 0xbd,
391 0x92, 0x06, 0x08, 0x61, 0x02, 0x00, 0x00, 0xc5, 0x02, 0x00, 0x00, 0x9a, 888 0x05,
392 0x06, 0x10, 0x62, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x02, 889 0xda,
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x06, 0x08, 0x00, 0xc0, 0x18, 890 0x05,
394 0x44, 0x00, 0xc0, 0x31, 0x44, 0xaa, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 891 0x04,
395 0x00, 0x20, 0x83, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x86, 0x40, 892 0xda,
396 0xb2, 0x06, 0x02, 0x01, 0x00, 0xba, 0x06, 0x02, 0x05, 0x06 893 0x04,
894 0xbe,
895 0x05,
896 0xe2,
897 0x05,
898 0x04,
899 0xdb,
900 0x04,
901 0xbf,
902 0x05,
903 0xea,
904 0x05,
905 0x04,
906 0xdc,
907 0x04,
908 0xc0,
909 0x05,
910 0xf2,
911 0x05,
912 0x04,
913 0xba,
914 0x09,
915 0x82,
916 0x0b,
917 0xfa,
918 0x05,
919 0x04,
920 0xbc,
921 0x09,
922 0x84,
923 0x0b,
924 0x82,
925 0x06,
926 0x08,
927 0x5f,
928 0x02,
929 0x00,
930 0x00,
931 0xc3,
932 0x02,
933 0x00,
934 0x00,
935 0x8a,
936 0x06,
937 0x10,
938 0x60,
939 0x02,
940 0x00,
941 0x00,
942 0x00,
943 0x00,
944 0x00,
945 0x00,
946 0xc4,
947 0x02,
948 0x00,
949 0x00,
950 0x00,
951 0x00,
952 0x00,
953 0x00,
954 0x92,
955 0x06,
956 0x08,
957 0x61,
958 0x02,
959 0x00,
960 0x00,
961 0xc5,
962 0x02,
963 0x00,
964 0x00,
965 0x9a,
966 0x06,
967 0x10,
968 0x62,
969 0x02,
970 0x00,
971 0x00,
972 0x00,
973 0x00,
974 0x00,
975 0x00,
976 0xc6,
977 0x02,
978 0x00,
979 0x00,
980 0x00,
981 0x00,
982 0x00,
983 0x00,
984 0xa2,
985 0x06,
986 0x08,
987 0x00,
988 0xc0,
989 0x18,
990 0x44,
991 0x00,
992 0xc0,
993 0x31,
994 0x44,
995 0xaa,
996 0x06,
997 0x10,
998 0x00,
999 0x00,
1000 0x00,
1001 0x00,
1002 0x00,
1003 0x20,
1004 0x83,
1005 0x40,
1006 0x00,
1007 0x00,
1008 0x00,
1009 0x00,
1010 0x00,
1011 0x40,
1012 0x86,
1013 0x40,
1014 0xb2,
1015 0x06,
1016 0x02,
1017 0x01,
1018 0x00,
1019 0xba,
1020 0x06,
1021 0x02,
1022 0x05,
1023 0x06
397 ]; 1024 ];
398 expect(getPackedSet().writeToBuffer(), goldenPackedMessage); 1025 expect(getPackedSet().writeToBuffer(), goldenPackedMessage);
399 }); 1026 });
400 1027
401 test('testWriteMessageWithNegativeEnumValue', () { 1028 test('testWriteMessageWithNegativeEnumValue', () {
402 SparseEnumMessage message = new SparseEnumMessage() 1029 SparseEnumMessage message = new SparseEnumMessage()
403 ..sparseEnum = TestSparseEnum.SPARSE_E; 1030 ..sparseEnum = TestSparseEnum.SPARSE_E;
404 expect(message.sparseEnum.value < 0, isTrue, 1031 expect(message.sparseEnum.value < 0, isTrue,
405 reason: 'enum.value should be -53452'); 1032 reason: 'enum.value should be -53452');
406 SparseEnumMessage message2 = 1033 SparseEnumMessage message2 =
407 new SparseEnumMessage.fromBuffer(message.writeToBuffer()); 1034 new SparseEnumMessage.fromBuffer(message.writeToBuffer());
408 expect(message2.sparseEnum, TestSparseEnum.SPARSE_E, 1035 expect(message2.sparseEnum, TestSparseEnum.SPARSE_E,
409 reason: 'should resolve back to SPARSE_E'); 1036 reason: 'should resolve back to SPARSE_E');
410 }); 1037 });
411 1038
412 test('testReservedNamesOptional', () { 1039 test('testReservedNamesOptional', () {
413 ReservedNamesOptional message = new ReservedNamesOptional(); 1040 ReservedNamesOptional message = new ReservedNamesOptional();
414 message.hashCode_1 = 1; 1041 message.hashCode_1 = 1;
415 expect(message.hashCode_1, 1); 1042 expect(message.hashCode_1, 1);
416 expect(message.hasHashCode_1(), isTrue); 1043 expect(message.hasHashCode_1(), isTrue);
417 message.clearHashCode_1(); 1044 message.clearHashCode_1();
418 1045
419 message.noSuchMethod_2 = 1; 1046 message.noSuchMethod_2 = 1;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 message.m3 = new p3.M(); 1281 message.m3 = new p3.M();
655 message.m3M = new p3.M_M(); 1282 message.m3M = new p3.M_M();
656 }); 1283 });
657 1284
658 test('testToplevel', () { 1285 test('testToplevel', () {
659 t.M message = new t.M(); 1286 t.M message = new t.M();
660 message.t = new T(); 1287 message.t = new T();
661 new t.SApi(null); 1288 new t.SApi(null);
662 }); 1289 });
663 } 1290 }
OLDNEW
« no previous file with comments | « test/file_generator_test.dart ('k') | test/message_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698