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:unittest/unittest.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 }, |
| 27 setters: { |
| 28 #i: (o, v) { o.i = v; }, |
| 29 }, |
| 30 parents: { |
| 31 smoke_0.AnnotB: smoke_0.Annot, |
| 32 smoke_0.D: _M0, |
| 33 smoke_0.E2: smoke_0.E, |
| 34 smoke_0.F2: smoke_0.F, |
| 35 _M0: smoke_0.C, |
| 36 }, |
| 37 declarations: { |
| 38 smoke_0.A: { |
| 39 #i: const Declaration(#i, int), |
| 40 #inc0: const Declaration(#inc0, Function, kind: METHOD), |
| 41 #inc1: const Declaration(#inc1, Function, kind: METHOD), |
| 42 #inc2: const Declaration(#inc2, Function, kind: METHOD), |
| 43 #j: const Declaration(#j, int), |
| 44 #j2: const Declaration(#j2, int, kind: PROPERTY), |
| 45 }, |
| 46 smoke_0.B: { |
| 47 #f: const Declaration(#f, int, isFinal: true), |
| 48 #w: const Declaration(#w, int, kind: PROPERTY), |
| 49 }, |
| 50 smoke_0.C: { |
| 51 #b: const Declaration(#b, smoke_0.B), |
| 52 #inc: const Declaration(#inc, Function, kind: METHOD), |
| 53 #x: const Declaration(#x, int), |
| 54 #y: const Declaration(#y, String), |
| 55 }, |
| 56 smoke_0.D: { |
| 57 #i2: const Declaration(#i2, int, kind: PROPERTY, isFinal: true), |
| 58 #x2: const Declaration(#x2, int, kind: PROPERTY, isFinal: true), |
| 59 }, |
| 60 smoke_0.E: { |
| 61 #noSuchMethod: const Declaration(#noSuchMethod, Function, kind: METHOD), |
| 62 #y: const Declaration(#y, int, kind: PROPERTY, isFinal: true), |
| 63 }, |
| 64 smoke_0.E2: {}, |
| 65 smoke_0.F: { |
| 66 #staticMethod: const Declaration(#staticMethod, Function, kind: METHOD,
isStatic: true), |
| 67 }, |
| 68 smoke_0.F2: {}, |
| 69 smoke_0.G: { |
| 70 #b: const Declaration(#b, int, annotations: const [smoke_0.a1]), |
| 71 #d: const Declaration(#d, int, annotations: const [smoke_0.a2]), |
| 72 }, |
| 73 _M0: { |
| 74 #i: const Declaration(#i, int), |
| 75 #inc: const Declaration(#inc, Function, kind: METHOD), |
| 76 #inc0: const Declaration(#inc0, Function, kind: METHOD), |
| 77 #j: const Declaration(#j, int), |
| 78 #j2: const Declaration(#j2, int, kind: PROPERTY), |
| 79 }, |
| 80 }, |
| 81 staticMethods: {}, |
| 82 names: {}); |
| 83 |
| 84 main() { |
| 85 useGeneratedCode(configuration); |
| 86 |
| 87 expect(configuration.getters[#j], isNull); |
| 88 |
| 89 configuration.addAll(p1.configuration); |
| 90 expect(configuration.getters[#j], isNotNull); |
| 91 |
| 92 p2.loadLibrary().then((_) { |
| 93 expect(configuration.names[#i], isNull); |
| 94 configuration.addAll(p2.configuration); |
| 95 expect(configuration.names[#i], 'i'); |
| 96 common.main(); |
| 97 }); |
| 98 } |
OLD | NEW |