OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test program for checking implemention of MirrorSystem when | 5 // Dart test program for checking implemention of MirrorSystem when |
6 // inspecting the current isolate. | 6 // inspecting the current isolate. |
7 // | 7 // |
8 // VMOptions=--enable_type_checks | 8 // VMOptions=--enable_type_checks |
9 | 9 |
10 #library('isolate_mirror_local_test'); | 10 #library('isolate_mirror_local_test'); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 lib_mirror.invoke('function', [ 123 ]).then( | 118 lib_mirror.invoke('function', [ 123 ]).then( |
119 (InstanceMirror retval) { | 119 (InstanceMirror retval) { |
120 Expect.equals(123, global_var); | 120 Expect.equals(123, global_var); |
121 Expect.equals('int', retval.type.simpleName); | 121 Expect.equals('int', retval.type.simpleName); |
122 Expect.isTrue(retval.hasReflectee); | 122 Expect.isTrue(retval.hasReflectee); |
123 Expect.equals(124, retval.reflectee); | 123 Expect.equals(124, retval.reflectee); |
124 testDone('testRootLibraryMirror'); | 124 testDone('testRootLibraryMirror'); |
125 }); | 125 }); |
126 | 126 |
127 // Check that the members map is complete. | 127 // Check that the members map is complete. |
128 List keys = lib_mirror.members.getKeys(); | 128 List keys = lib_mirror.members.keys; |
129 sort(keys); | 129 sort(keys); |
130 Expect.equals('[' | 130 Expect.equals('[' |
131 'FuncType, ' | 131 'FuncType, ' |
132 'GenericClass, ' | 132 'GenericClass, ' |
133 'MyClass, ' | 133 'MyClass, ' |
134 'MyException, ' | 134 'MyException, ' |
135 'MyInterface, ' | 135 'MyInterface, ' |
136 'MySuperClass, ' | 136 'MySuperClass, ' |
137 '_stringCompare, ' | 137 '_stringCompare, ' |
138 'buildMethodString, ' | 138 'buildMethodString, ' |
(...skipping 16 matching lines...) Expand all Loading... |
155 'testIntegerInstanceMirror, ' | 155 'testIntegerInstanceMirror, ' |
156 'testLibrariesMap, ' | 156 'testLibrariesMap, ' |
157 'testMirrorErrors, ' | 157 'testMirrorErrors, ' |
158 'testMirrorSystem, ' | 158 'testMirrorSystem, ' |
159 'testNullInstanceMirror, ' | 159 'testNullInstanceMirror, ' |
160 'testRootLibraryMirror, ' | 160 'testRootLibraryMirror, ' |
161 'testStringInstanceMirror]', | 161 'testStringInstanceMirror]', |
162 '$keys'); | 162 '$keys'); |
163 | 163 |
164 // Check that the classes map is complete. | 164 // Check that the classes map is complete. |
165 keys = lib_mirror.classes.getKeys(); | 165 keys = lib_mirror.classes.keys; |
166 sort(keys); | 166 sort(keys); |
167 Expect.equals('[' | 167 Expect.equals('[' |
168 'FuncType, ' | 168 'FuncType, ' |
169 'GenericClass, ' | 169 'GenericClass, ' |
170 'MyClass, ' | 170 'MyClass, ' |
171 'MyException, ' | 171 'MyException, ' |
172 'MyInterface, ' | 172 'MyInterface, ' |
173 'MySuperClass]', | 173 'MySuperClass]', |
174 '$keys'); | 174 '$keys'); |
175 | 175 |
176 // Check that the functions map is complete. | 176 // Check that the functions map is complete. |
177 keys = lib_mirror.functions.getKeys(); | 177 keys = lib_mirror.functions.keys; |
178 sort(keys); | 178 sort(keys); |
179 Expect.equals('[' | 179 Expect.equals('[' |
180 '_stringCompare, ' | 180 '_stringCompare, ' |
181 'buildMethodString, ' | 181 'buildMethodString, ' |
182 'buildVariableString, ' | 182 'buildVariableString, ' |
183 'function, ' | 183 'function, ' |
184 'main, ' | 184 'main, ' |
185 'methodWithError, ' | 185 'methodWithError, ' |
186 'methodWithException, ' | 186 'methodWithException, ' |
187 'myVar, ' | 187 'myVar, ' |
188 'myVar=, ' | 188 'myVar=, ' |
189 'sort, ' | 189 'sort, ' |
190 'testBoolInstanceMirror, ' | 190 'testBoolInstanceMirror, ' |
191 'testCustomInstanceMirror, ' | 191 'testCustomInstanceMirror, ' |
192 'testDone, ' | 192 'testDone, ' |
193 'testIntegerInstanceMirror, ' | 193 'testIntegerInstanceMirror, ' |
194 'testLibrariesMap, ' | 194 'testLibrariesMap, ' |
195 'testMirrorErrors, ' | 195 'testMirrorErrors, ' |
196 'testMirrorSystem, ' | 196 'testMirrorSystem, ' |
197 'testNullInstanceMirror, ' | 197 'testNullInstanceMirror, ' |
198 'testRootLibraryMirror, ' | 198 'testRootLibraryMirror, ' |
199 'testStringInstanceMirror]', | 199 'testStringInstanceMirror]', |
200 '$keys'); | 200 '$keys'); |
201 | 201 |
202 // Check that the getters map is complete. | 202 // Check that the getters map is complete. |
203 keys = lib_mirror.getters.getKeys(); | 203 keys = lib_mirror.getters.keys; |
204 sort(keys); | 204 sort(keys); |
205 Expect.equals('[myVar]', '$keys'); | 205 Expect.equals('[myVar]', '$keys'); |
206 | 206 |
207 // Check that the setters map is complete. | 207 // Check that the setters map is complete. |
208 keys = lib_mirror.setters.getKeys(); | 208 keys = lib_mirror.setters.keys; |
209 sort(keys); | 209 sort(keys); |
210 Expect.equals('[myVar=]', '$keys'); | 210 Expect.equals('[myVar=]', '$keys'); |
211 | 211 |
212 // Check that the variables map is complete. | 212 // Check that the variables map is complete. |
213 keys = lib_mirror.variables.getKeys(); | 213 keys = lib_mirror.variables.keys; |
214 sort(keys); | 214 sort(keys); |
215 Expect.equals('[' | 215 Expect.equals('[' |
216 'exit_port, ' | 216 'exit_port, ' |
217 'expectedTests, ' | 217 'expectedTests, ' |
218 'final_global_var, ' | 218 'final_global_var, ' |
219 'global_var, ' | 219 'global_var, ' |
220 'myFunc]', | 220 'myFunc]', |
221 '$keys'); | 221 '$keys'); |
222 | 222 |
223 ClassMirror cls_mirror = lib_mirror.members['MyClass']; | 223 ClassMirror cls_mirror = lib_mirror.members['MyClass']; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 // Test that an isolate can reflect on itself. | 533 // Test that an isolate can reflect on itself. |
534 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 534 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
535 | 535 |
536 testIntegerInstanceMirror(reflect(1001)); | 536 testIntegerInstanceMirror(reflect(1001)); |
537 testStringInstanceMirror(reflect('This\nis\na\nString')); | 537 testStringInstanceMirror(reflect('This\nis\na\nString')); |
538 testBoolInstanceMirror(reflect(true)); | 538 testBoolInstanceMirror(reflect(true)); |
539 testNullInstanceMirror(reflect(null)); | 539 testNullInstanceMirror(reflect(null)); |
540 testCustomInstanceMirror(reflect(new MyClass(17))); | 540 testCustomInstanceMirror(reflect(new MyClass(17))); |
541 testMirrorErrors(currentMirrorSystem()); | 541 testMirrorErrors(currentMirrorSystem()); |
542 } | 542 } |
OLD | NEW |