OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 library test.library_declarations_test; | 5 library test.library_declarations_test; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 | 9 |
10 import 'stringify.dart'; | 10 import 'stringify.dart'; |
11 import 'declarations_model.dart' as declarations_model; | 11 import 'declarations_model.dart' as declarations_model; |
12 | 12 |
13 main() { | 13 main() { |
14 LibraryMirror lm = | 14 LibraryMirror lm = |
15 currentMirrorSystem().findLibrary(#test.declarations_model); | 15 currentMirrorSystem().findLibrary(#test.declarations_model); |
16 | 16 |
17 Expect.setEquals( | 17 Expect.setEquals([ |
18 ['Variable(s(_libraryVariable)' | 18 'Variable(s(_libraryVariable)' |
19 ' in s(test.declarations_model), private, top-level, static)', | 19 ' in s(test.declarations_model), private, top-level, static)', |
20 'Variable(s(libraryVariable)' | 20 'Variable(s(libraryVariable)' |
21 ' in s(test.declarations_model), top-level, static)'], | 21 ' in s(test.declarations_model), top-level, static)' |
22 lm.declarations.values.where((dm) => dm is VariableMirror).map(stringify), | 22 ], lm.declarations.values.where((dm) => dm is VariableMirror).map(stringify), |
23 'variables'); | 23 'variables'); |
24 | 24 |
25 // dart2js stops testing here. | 25 // dart2js stops testing here. |
26 return; // //# 01: ok | 26 return; // //# 01: ok |
27 | 27 |
28 Expect.setEquals( | 28 Expect.setEquals( |
29 ['Method(s(_libraryGetter)' | 29 [ |
30 ' in s(test.declarations_model), private, top-level, static, getter)', | 30 'Method(s(_libraryGetter)' |
31 'Method(s(libraryGetter)' | 31 ' in s(test.declarations_model), private, top-level, static, getter)
', |
32 ' in s(test.declarations_model), top-level, static, getter)'], | 32 'Method(s(libraryGetter)' |
33 lm.declarations.values | 33 ' in s(test.declarations_model), top-level, static, getter)' |
34 .where((dm) => dm is MethodMirror && dm.isGetter).map(stringify), | 34 ], |
35 'getters'); | 35 lm.declarations.values |
| 36 .where((dm) => dm is MethodMirror && dm.isGetter) |
| 37 .map(stringify), |
| 38 'getters'); |
36 | 39 |
37 Expect.setEquals( | 40 Expect.setEquals( |
38 ['Method(s(_librarySetter=)' | 41 [ |
39 ' in s(test.declarations_model), private, top-level, static, setter)', | 42 'Method(s(_librarySetter=)' |
40 'Method(s(librarySetter=)' | 43 ' in s(test.declarations_model), private, top-level, static, setter)
', |
41 ' in s(test.declarations_model), top-level, static, setter)'], | 44 'Method(s(librarySetter=)' |
42 lm.declarations.values | 45 ' in s(test.declarations_model), top-level, static, setter)' |
43 .where((dm) => dm is MethodMirror && dm.isSetter).map(stringify), | 46 ], |
44 'setters'); | 47 lm.declarations.values |
| 48 .where((dm) => dm is MethodMirror && dm.isSetter) |
| 49 .map(stringify), |
| 50 'setters'); |
45 | 51 |
46 Expect.setEquals( | 52 Expect.setEquals( |
47 ['Method(s(_libraryMethod)' | 53 [ |
48 ' in s(test.declarations_model), private, top-level, static)', | 54 'Method(s(_libraryMethod)' |
49 'Method(s(libraryMethod)' | 55 ' in s(test.declarations_model), private, top-level, static)', |
50 ' in s(test.declarations_model), top-level, static)'], | 56 'Method(s(libraryMethod)' |
51 lm.declarations.values | 57 ' in s(test.declarations_model), top-level, static)' |
52 .where((dm) => dm is MethodMirror && dm.isRegularMethod).map(stringify), | 58 ], |
53 'regular methods'); | 59 lm.declarations.values |
| 60 .where((dm) => dm is MethodMirror && dm.isRegularMethod) |
| 61 .map(stringify), |
| 62 'regular methods'); |
54 | 63 |
55 Expect.setEquals( | 64 Expect.setEquals([ |
56 ['Class(s(Class) in s(test.declarations_model), top-level)', | 65 'Class(s(Class) in s(test.declarations_model), top-level)', |
57 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', | 66 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', |
58 'Class(s(Interface) in s(test.declarations_model), top-level)', | 67 'Class(s(Interface) in s(test.declarations_model), top-level)', |
59 'Class(s(Mixin) in s(test.declarations_model), top-level)', | 68 'Class(s(Mixin) in s(test.declarations_model), top-level)', |
60 'Class(s(Superclass) in s(test.declarations_model), top-level)', | 69 'Class(s(Superclass) in s(test.declarations_model), top-level)', |
61 'Class(s(_PrivateClass)' | 70 'Class(s(_PrivateClass)' |
62 ' in s(test.declarations_model), private, top-level)'], | 71 ' in s(test.declarations_model), private, top-level)' |
63 lm.declarations.values | 72 ], lm.declarations.values.where((dm) => dm is ClassMirror).map(stringify), |
64 .where((dm) => dm is ClassMirror).map(stringify), | 73 'classes'); |
65 'classes'); | |
66 | 74 |
67 Expect.setEquals( | 75 Expect.setEquals([ |
68 ['Class(s(Class) in s(test.declarations_model), top-level)', | 76 'Class(s(Class) in s(test.declarations_model), top-level)', |
69 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', | 77 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', |
70 'Class(s(Interface) in s(test.declarations_model), top-level)', | 78 'Class(s(Interface) in s(test.declarations_model), top-level)', |
71 'Class(s(Mixin) in s(test.declarations_model), top-level)', | 79 'Class(s(Mixin) in s(test.declarations_model), top-level)', |
72 'Type(s(Predicate) in s(test.declarations_model), top-level)', | 80 'Type(s(Predicate) in s(test.declarations_model), top-level)', |
73 'Class(s(Superclass) in s(test.declarations_model), top-level)', | 81 'Class(s(Superclass) in s(test.declarations_model), top-level)', |
74 'Class(s(_PrivateClass)' | 82 'Class(s(_PrivateClass)' |
75 ' in s(test.declarations_model), private, top-level)'], | 83 ' in s(test.declarations_model), private, top-level)' |
76 lm.declarations.values.where((dm) => dm is TypeMirror).map(stringify), | 84 ], lm.declarations.values.where((dm) => dm is TypeMirror).map(stringify), |
77 'types'); | 85 'types'); |
78 | 86 |
79 Expect.setEquals( | 87 Expect.setEquals([ |
80 ['Class(s(Class) in s(test.declarations_model), top-level)', | 88 'Class(s(Class) in s(test.declarations_model), top-level)', |
81 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', | 89 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', |
82 'Class(s(Interface) in s(test.declarations_model), top-level)', | 90 'Class(s(Interface) in s(test.declarations_model), top-level)', |
83 'Class(s(Mixin) in s(test.declarations_model), top-level)', | 91 'Class(s(Mixin) in s(test.declarations_model), top-level)', |
84 'Type(s(Predicate) in s(test.declarations_model), top-level)', | 92 'Type(s(Predicate) in s(test.declarations_model), top-level)', |
85 'Class(s(Superclass) in s(test.declarations_model), top-level)', | 93 'Class(s(Superclass) in s(test.declarations_model), top-level)', |
86 'Method(s(libraryGetter)' | 94 'Method(s(libraryGetter)' |
87 ' in s(test.declarations_model), top-level, static, getter)', | 95 ' in s(test.declarations_model), top-level, static, getter)', |
88 'Method(s(libraryMethod)' | 96 'Method(s(libraryMethod)' |
89 ' in s(test.declarations_model), top-level, static)', | 97 ' in s(test.declarations_model), top-level, static)', |
90 'Method(s(librarySetter=)' | 98 'Method(s(librarySetter=)' |
91 ' in s(test.declarations_model), top-level, static, setter)', | 99 ' in s(test.declarations_model), top-level, static, setter)', |
92 'Variable(s(libraryVariable)' | 100 'Variable(s(libraryVariable)' |
93 ' in s(test.declarations_model), top-level, static)'], | 101 ' in s(test.declarations_model), top-level, static)' |
94 lm.declarations.values.where((dm) => !dm.isPrivate).map(stringify), | 102 ], lm.declarations.values.where((dm) => !dm.isPrivate).map(stringify), |
95 'public'); | 103 'public'); |
96 | 104 |
97 Expect.setEquals( | 105 Expect.setEquals([ |
98 ['Class(s(Class) in s(test.declarations_model), top-level)', | 106 'Class(s(Class) in s(test.declarations_model), top-level)', |
99 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', | 107 'Class(s(ConcreteClass) in s(test.declarations_model), top-level)', |
100 'Class(s(Interface) in s(test.declarations_model), top-level)', | 108 'Class(s(Interface) in s(test.declarations_model), top-level)', |
101 'Class(s(Mixin) in s(test.declarations_model), top-level)', | 109 'Class(s(Mixin) in s(test.declarations_model), top-level)', |
102 'Type(s(Predicate) in s(test.declarations_model), top-level)', | 110 'Type(s(Predicate) in s(test.declarations_model), top-level)', |
103 'Class(s(Superclass) in s(test.declarations_model), top-level)', | 111 'Class(s(Superclass) in s(test.declarations_model), top-level)', |
104 'Class(s(_PrivateClass) in s(test.declarations_model), private, top-level)', | 112 'Class(s(_PrivateClass) in s(test.declarations_model), private, top-level)', |
105 'Method(s(_libraryGetter)' | 113 'Method(s(_libraryGetter)' |
106 ' in s(test.declarations_model), private, top-level, static, getter)', | 114 ' in s(test.declarations_model), private, top-level, static, getter)', |
107 'Method(s(_libraryMethod)' | 115 'Method(s(_libraryMethod)' |
108 ' in s(test.declarations_model), private, top-level, static)', | 116 ' in s(test.declarations_model), private, top-level, static)', |
109 'Method(s(_librarySetter=)' | 117 'Method(s(_librarySetter=)' |
110 ' in s(test.declarations_model), private, top-level, static, setter)', | 118 ' in s(test.declarations_model), private, top-level, static, setter)', |
111 'Variable(s(_libraryVariable)' | 119 'Variable(s(_libraryVariable)' |
112 ' in s(test.declarations_model), private, top-level, static)', | 120 ' in s(test.declarations_model), private, top-level, static)', |
113 'Method(s(libraryGetter)' | 121 'Method(s(libraryGetter)' |
114 ' in s(test.declarations_model), top-level, static, getter)', | 122 ' in s(test.declarations_model), top-level, static, getter)', |
115 'Method(s(libraryMethod) in s(test.declarations_model), top-level, static)', | 123 'Method(s(libraryMethod) in s(test.declarations_model), top-level, static)', |
116 'Method(s(librarySetter=)' | 124 'Method(s(librarySetter=)' |
117 ' in s(test.declarations_model), top-level, static, setter)', | 125 ' in s(test.declarations_model), top-level, static, setter)', |
118 'Variable(s(libraryVariable)' | 126 'Variable(s(libraryVariable)' |
119 ' in s(test.declarations_model), top-level, static)'], | 127 ' in s(test.declarations_model), top-level, static)' |
120 lm.declarations.values.map(stringify), | 128 ], lm.declarations.values.map(stringify), 'all declarations'); |
121 'all declarations'); | |
122 } | 129 } |
OLD | NEW |