| OLD | NEW |
| 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:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.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/nested_extension.pb.dart'; | 15 import '../out/protos/nested_extension.pb.dart'; |
| 16 import '../out/protos/non_nested_extension.pb.dart'; | 16 import '../out/protos/non_nested_extension.pb.dart'; |
| 17 | 17 |
| 18 import 'test_util.dart'; | 18 import 'test_util.dart'; |
| 19 | 19 |
| 20 void main() { | 20 void main() { |
| 21 final throwsInvalidProtocolBufferException = | 21 final throwsInvalidProtocolBufferException = |
| 22 throwsA(new isInstanceOf<InvalidProtocolBufferException>()); | 22 throwsA(new isInstanceOf<InvalidProtocolBufferException>()); |
| 23 | |
| 24 test('testProtosShareRepeatedArraysIfDidntChange', () { | 23 test('testProtosShareRepeatedArraysIfDidntChange', () { |
| 25 TestAllTypes value1 = new TestAllTypes() | 24 TestAllTypes value1 = new TestAllTypes() |
| 26 ..repeatedInt32.add(100) | 25 ..repeatedInt32.add(100) |
| 27 ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR) | 26 ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR) |
| 28 ..repeatedForeignMessage.add(new ForeignMessage()); | 27 ..repeatedForeignMessage.add(new ForeignMessage()); |
| 29 | 28 |
| 30 TestAllTypes value2 = value1.clone(); | 29 TestAllTypes value2 = value1.clone(); |
| 31 | 30 |
| 32 expect(value2.repeatedInt32, value1.repeatedInt32); | 31 expect(value2.repeatedInt32, value1.repeatedInt32); |
| 33 expect(value2.repeatedImportEnum, value1.repeatedImportEnum); | 32 expect(value2.repeatedImportEnum, value1.repeatedImportEnum); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 SparseEnumMessage message = new SparseEnumMessage() | 453 SparseEnumMessage message = new SparseEnumMessage() |
| 455 ..sparseEnum = TestSparseEnum.SPARSE_E; | 454 ..sparseEnum = TestSparseEnum.SPARSE_E; |
| 456 expect(message.sparseEnum.value < 0, isTrue, | 455 expect(message.sparseEnum.value < 0, isTrue, |
| 457 reason: 'enum.value should be -53452'); | 456 reason: 'enum.value should be -53452'); |
| 458 SparseEnumMessage message2 = | 457 SparseEnumMessage message2 = |
| 459 new SparseEnumMessage.fromBuffer(message.writeToBuffer()); | 458 new SparseEnumMessage.fromBuffer(message.writeToBuffer()); |
| 460 expect(message2.sparseEnum, TestSparseEnum.SPARSE_E, | 459 expect(message2.sparseEnum, TestSparseEnum.SPARSE_E, |
| 461 reason: 'should resolve back to SPARSE_E'); | 460 reason: 'should resolve back to SPARSE_E'); |
| 462 }); | 461 }); |
| 463 } | 462 } |
| OLD | NEW |