OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, 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 library test.toplevel_members; | |
6 | |
7 import 'dart:mirrors'; | |
8 import 'package:expect/expect.dart'; | |
9 | |
10 import 'stringify.dart'; | |
11 import 'declarations_model.dart' as declarations_model; | |
12 | |
13 selectKeys(map, predicate) { | |
14 return map.keys.where((key) => predicate(map[key])); | |
15 } | |
16 | |
17 main() { | |
18 LibraryMirror lm = | |
19 currentMirrorSystem().findLibrary(#test.declarations_model); | |
20 | |
21 Expect.setEquals( | |
22 [#libraryVariable, | |
23 const Symbol('libraryVariable='), | |
24 #libraryGetter, | |
25 const Symbol('librarySetter='), | |
26 #libraryMethod, | |
27 MirrorSystem.getSymbol('_libraryVariable', lm), | |
28 MirrorSystem.getSymbol('_libraryVariable=', lm), | |
29 MirrorSystem.getSymbol('_libraryGetter', lm), | |
30 MirrorSystem.getSymbol('_librarySetter=', lm), | |
31 MirrorSystem.getSymbol('_libraryMethod', lm), | |
32 #Predicate, /// 01: ok | |
33 #Superclass, /// 01: continued | |
34 #Interface, /// 01: continued | |
35 #Mixin, /// 01: continued | |
36 #Class, /// 01: continued | |
37 MirrorSystem.getSymbol('_PrivateClass', lm), /// 01: continued | |
38 #ConcreteClass /// 01: continued | |
39 ], | |
40 selectKeys(lm.topLevelMembers, (dm) => true)); | |
41 | |
42 Expect.setEquals( | |
43 [#libraryVariable, | |
44 const Symbol('libraryVariable='), | |
45 MirrorSystem.getSymbol('_libraryVariable', lm), | |
46 MirrorSystem.getSymbol('_libraryVariable=', lm), | |
47 #Predicate, /// 01: continued | |
48 #Superclass, /// 01: continued | |
49 #Interface, /// 01: continued | |
50 #Mixin, /// 01: continued | |
51 #Class, /// 01: continued | |
52 MirrorSystem.getSymbol('_PrivateClass', lm), /// 01: continued | |
53 #ConcreteClass /// 01: continued | |
54 ], | |
55 selectKeys(lm.topLevelMembers, (dm) => dm.isSynthetic)); | |
56 } | |
OLD | NEW |