OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /// Tests that a static configuration can be loaded in pieces, even with | |
6 /// deferred imports. | |
7 library smoke.test.static_in_pieces_test; | |
8 | |
9 import 'package:test/test.dart'; | |
10 import 'package:smoke/smoke.dart' show Declaration, PROPERTY, METHOD; | |
11 import 'package:smoke/static.dart' show useGeneratedCode, StaticConfiguration; | |
12 import 'piece1.dart' as p1; | |
13 import 'piece2.dart' deferred as p2; | |
14 import 'common.dart' as smoke_0; | |
15 import 'common.dart' as common show main; | |
16 | |
17 abstract class _M0 {} // C & A | |
18 | |
19 final configuration = new StaticConfiguration( | |
20 checkedMode: false, | |
21 getters: { | |
22 #i: (o) => o.i, | |
23 #inc0: (o) => o.inc0, | |
24 #inc1: (o) => o.inc1, | |
25 #inc2: (o) => o.inc2, | |
26 #toString: (o) => o.toString, | |
27 }, | |
28 setters: { | |
29 #i: (o, v) { | |
30 o.i = v; | |
31 }, | |
32 }, | |
33 parents: { | |
34 smoke_0.AnnotB: smoke_0.Annot, | |
35 smoke_0.D: _M0, | |
36 smoke_0.E2: smoke_0.E, | |
37 smoke_0.F2: smoke_0.F, | |
38 _M0: smoke_0.C, | |
39 }, | |
40 declarations: { | |
41 smoke_0.A: { | |
42 #i: const Declaration(#i, int), | |
43 #inc0: const Declaration(#inc0, Function, kind: METHOD), | |
44 #inc1: const Declaration(#inc1, Function, kind: METHOD), | |
45 #inc2: const Declaration(#inc2, Function, kind: METHOD), | |
46 #j: const Declaration(#j, int), | |
47 #j2: const Declaration(#j2, int, kind: PROPERTY), | |
48 }, | |
49 smoke_0.B: { | |
50 #f: const Declaration(#f, int, isFinal: true), | |
51 #w: const Declaration(#w, int, kind: PROPERTY), | |
52 }, | |
53 smoke_0.C: { | |
54 #b: const Declaration(#b, smoke_0.B), | |
55 #inc: const Declaration(#inc, Function, kind: METHOD), | |
56 #x: const Declaration(#x, int), | |
57 #y: const Declaration(#y, String), | |
58 }, | |
59 smoke_0.D: { | |
60 #i2: const Declaration(#i2, int, kind: PROPERTY, isFinal: true), | |
61 #x2: const Declaration(#x2, int, kind: PROPERTY, isFinal: true), | |
62 }, | |
63 smoke_0.E: { | |
64 #noSuchMethod: const Declaration(#noSuchMethod, Function, kind: METHOD), | |
65 #y: const Declaration(#y, int, kind: PROPERTY, isFinal: true), | |
66 }, | |
67 smoke_0.E2: {}, | |
68 smoke_0.F: { | |
69 #staticMethod: const Declaration(#staticMethod, Function, | |
70 kind: METHOD, isStatic: true), | |
71 }, | |
72 smoke_0.F2: {}, | |
73 smoke_0.G: { | |
74 #b: const Declaration(#b, int, annotations: const [smoke_0.a1]), | |
75 #d: const Declaration(#d, int, annotations: const [smoke_0.a2]), | |
76 }, | |
77 smoke_0.L: { | |
78 #incM: const Declaration(#incM, Function, kind: METHOD), | |
79 #m: const Declaration(#m, int, kind: PROPERTY, isFinal: true), | |
80 }, | |
81 smoke_0.L2: { | |
82 #incM: const Declaration(#incM, Function, kind: METHOD), | |
83 #m: const Declaration(#m, int), | |
84 #n: const Declaration(#n, int), | |
85 }, | |
86 _M0: { | |
87 #i: const Declaration(#i, int), | |
88 #inc: const Declaration(#inc, Function, kind: METHOD), | |
89 #inc0: const Declaration(#inc0, Function, kind: METHOD), | |
90 #j: const Declaration(#j, int), | |
91 #j2: const Declaration(#j2, int, kind: PROPERTY), | |
92 }, | |
93 }, | |
94 staticMethods: {}, | |
95 names: {}); | |
96 | |
97 main() { | |
98 useGeneratedCode(configuration); | |
99 | |
100 test('smoke', () async { | |
101 expect(configuration.getters[#j], isNull); | |
102 | |
103 configuration.addAll(p1.configuration); | |
104 expect(configuration.getters[#j], isNotNull); | |
105 | |
106 await p2.loadLibrary(); | |
107 | |
108 expect(configuration.names[#i], isNull); | |
109 configuration.addAll(p2.configuration); | |
110 expect(configuration.names[#i], 'i'); | |
111 }); | |
112 | |
113 common.main(); | |
114 } | |
OLD | NEW |