OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Tests that a static configuration can be loaded in pieces, even with | 5 /// Tests that a static configuration can be loaded in pieces, even with |
6 /// deferred imports. | 6 /// deferred imports. |
7 library smoke.test.static_in_pieces_test; | 7 library smoke.test.static_in_pieces_test; |
8 | 8 |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:smoke/smoke.dart' show Declaration, PROPERTY, METHOD; | 10 import 'package:smoke/smoke.dart' show Declaration, PROPERTY, METHOD; |
11 import 'package:smoke/static.dart' show useGeneratedCode, StaticConfiguration; | 11 import 'package:smoke/static.dart' show useGeneratedCode, StaticConfiguration; |
12 import 'piece1.dart' as p1; | 12 import 'piece1.dart' as p1; |
13 import 'piece2.dart' deferred as p2; | 13 import 'piece2.dart' deferred as p2; |
14 import 'common.dart' as smoke_0; | 14 import 'common.dart' as smoke_0; |
15 import 'common.dart' as common show main; | 15 import 'common.dart' as common show main; |
16 | 16 |
17 abstract class _M0 {} // C & A | 17 abstract class _M0 {} // C & A |
18 | 18 |
19 final configuration = new StaticConfiguration( | 19 final configuration = new StaticConfiguration( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #j: const Declaration(#j, int), | 90 #j: const Declaration(#j, int), |
91 #j2: const Declaration(#j2, int, kind: PROPERTY), | 91 #j2: const Declaration(#j2, int, kind: PROPERTY), |
92 }, | 92 }, |
93 }, | 93 }, |
94 staticMethods: {}, | 94 staticMethods: {}, |
95 names: {}); | 95 names: {}); |
96 | 96 |
97 main() { | 97 main() { |
98 useGeneratedCode(configuration); | 98 useGeneratedCode(configuration); |
99 | 99 |
100 expect(configuration.getters[#j], isNull); | 100 test('smoke', () async { |
| 101 expect(configuration.getters[#j], isNull); |
101 | 102 |
102 configuration.addAll(p1.configuration); | 103 configuration.addAll(p1.configuration); |
103 expect(configuration.getters[#j], isNotNull); | 104 expect(configuration.getters[#j], isNotNull); |
104 | 105 |
105 p2.loadLibrary().then((_) { | 106 await p2.loadLibrary(); |
| 107 |
106 expect(configuration.names[#i], isNull); | 108 expect(configuration.names[#i], isNull); |
107 configuration.addAll(p2.configuration); | 109 configuration.addAll(p2.configuration); |
108 expect(configuration.names[#i], 'i'); | 110 expect(configuration.names[#i], 'i'); |
109 common.main(); | |
110 }); | 111 }); |
| 112 |
| 113 common.main(); |
111 } | 114 } |
OLD | NEW |