Chromium Code Reviews| 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 import '../out/protos/reserved_names.pb.dart'; | 17 import '../out/protos/reserved_names.pb.dart'; |
| 18 import '../out/protos/duplicate_names_import.pb.dart'; | 18 import '../out/protos/duplicate_names_import.pb.dart'; |
| 19 import '../out/protos/package1.pb.dart' as p1; | 19 import '../out/protos/package1.pb.dart' as p1; |
| 20 import '../out/protos/package2.pb.dart' as p2; | 20 import '../out/protos/package2.pb.dart' as p2; |
| 21 import '../out/protos/package3.pb.dart' as p3; | 21 import '../out/protos/package3.pb.dart' as p3; |
| 22 import '../out/protos/toplevel_import.pb.dart' as t; | 22 import '../out/protos/toplevel_import.pb.dart' as t; |
| 23 import '../out/protos/toplevel.pb.dart'; | 23 import '../out/protos/toplevel.pb.dart'; |
|
Siggi Cherem (dart-lang)
2014/12/19 21:53:14
to validate groups, it might be good to add a new
sra1
2014/12/19 23:11:02
proto TestAllTypes already has groups and various
| |
| 24 | 24 |
| 25 import 'test_util.dart'; | 25 import 'test_util.dart'; |
| 26 | 26 |
| 27 void main() { | 27 void main() { |
| 28 final throwsInvalidProtocolBufferException = | 28 final throwsInvalidProtocolBufferException = |
| 29 throwsA(new isInstanceOf<InvalidProtocolBufferException>()); | 29 throwsA(new isInstanceOf<InvalidProtocolBufferException>()); |
| 30 test('testProtosShareRepeatedArraysIfDidntChange', () { | 30 test('testProtosShareRepeatedArraysIfDidntChange', () { |
| 31 TestAllTypes value1 = new TestAllTypes() | 31 TestAllTypes value1 = new TestAllTypes() |
| 32 ..repeatedInt32.add(100) | 32 ..repeatedInt32.add(100) |
| 33 ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR) | 33 ..repeatedImportEnum.add(ImportEnum.IMPORT_BAR) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 new TestExtremeDefaultValues(); | 140 new TestExtremeDefaultValues(); |
| 141 | 141 |
| 142 expect(message.utf8String, '\u1234'); | 142 expect(message.utf8String, '\u1234'); |
| 143 expect(message.infDouble, same(double.INFINITY)); | 143 expect(message.infDouble, same(double.INFINITY)); |
| 144 expect(message.negInfDouble, same(double.NEGATIVE_INFINITY)); | 144 expect(message.negInfDouble, same(double.NEGATIVE_INFINITY)); |
| 145 expect(message.nanDouble, same(double.NAN)); | 145 expect(message.nanDouble, same(double.NAN)); |
| 146 expect(message.infFloat, same(double.INFINITY)); | 146 expect(message.infFloat, same(double.INFINITY)); |
| 147 expect(message.negInfFloat, same(double.NEGATIVE_INFINITY)); | 147 expect(message.negInfFloat, same(double.NEGATIVE_INFINITY)); |
| 148 expect(message.nanFloat, same(double.NAN)); | 148 expect(message.nanFloat, same(double.NAN)); |
| 149 expect(message.cppTrigraph, '? ? ?? ?? ??? ??/ ??-'); | 149 expect(message.cppTrigraph, '? ? ?? ?? ??? ??/ ??-'); |
| 150 expect(message.smallInt64.toRadixString(16).toUpperCase(), | |
| 151 '-7FFFFFFFFFFFFFFF'); | |
| 150 }); | 152 }); |
| 151 | 153 |
| 152 test('testClear', () { | 154 test('testClear', () { |
| 153 TestAllTypes message = new TestAllTypes(); | 155 TestAllTypes message = new TestAllTypes(); |
| 154 | 156 |
| 155 assertClear(message); | 157 assertClear(message); |
| 156 setAllFields(message); | 158 setAllFields(message); |
| 157 message.clear(); | 159 message.clear(); |
| 158 assertClear(message); | 160 assertClear(message); |
| 159 }); | 161 }); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 message.m2M = new p2.M_M(); | 713 message.m2M = new p2.M_M(); |
| 712 message.m3 = new p3.M(); | 714 message.m3 = new p3.M(); |
| 713 message.m3M = new p3.M_M(); | 715 message.m3M = new p3.M_M(); |
| 714 }); | 716 }); |
| 715 | 717 |
| 716 test('testToplevel', () { | 718 test('testToplevel', () { |
| 717 t.M message = new t.M(); | 719 t.M message = new t.M(); |
| 718 message.t = new T(); | 720 message.t = new T(); |
| 719 }); | 721 }); |
| 720 } | 722 } |
| OLD | NEW |