| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 lib_mirror.invoke('function', [ 123 ]).then( | 119 lib_mirror.invoke('function', [ 123 ]).then( |
| 120 (InstanceMirror retval) { | 120 (InstanceMirror retval) { |
| 121 Expect.equals(123, global_var); | 121 Expect.equals(123, global_var); |
| 122 Expect.equals('int', retval.type.simpleName); | 122 Expect.equals('int', retval.type.simpleName); |
| 123 Expect.isTrue(retval.hasReflectee); | 123 Expect.isTrue(retval.hasReflectee); |
| 124 Expect.equals(124, retval.reflectee); | 124 Expect.equals(124, retval.reflectee); |
| 125 testDone('testRootLibraryMirror'); | 125 testDone('testRootLibraryMirror'); |
| 126 }); | 126 }); |
| 127 | 127 |
| 128 // Check that the members map is complete. | 128 // Check that the members map is complete. |
| 129 List keys = lib_mirror.members.keys; | 129 List keys = lib_mirror.members.keys.toList(); |
| 130 sort(keys); | 130 sort(keys); |
| 131 Expect.equals('[' | 131 Expect.equals('[' |
| 132 'FuncType, ' | 132 'FuncType, ' |
| 133 'GenericClass, ' | 133 'GenericClass, ' |
| 134 'MyClass, ' | 134 'MyClass, ' |
| 135 'MyException, ' | 135 'MyException, ' |
| 136 'MyInterface, ' | 136 'MyInterface, ' |
| 137 'MySuperClass, ' | 137 'MySuperClass, ' |
| 138 '_stringCompare, ' | 138 '_stringCompare, ' |
| 139 'buildMethodString, ' | 139 'buildMethodString, ' |
| (...skipping 16 matching lines...) Expand all Loading... |
| 156 'testIntegerInstanceMirror, ' | 156 'testIntegerInstanceMirror, ' |
| 157 'testLibrariesMap, ' | 157 'testLibrariesMap, ' |
| 158 'testMirrorErrors, ' | 158 'testMirrorErrors, ' |
| 159 'testMirrorSystem, ' | 159 'testMirrorSystem, ' |
| 160 'testNullInstanceMirror, ' | 160 'testNullInstanceMirror, ' |
| 161 'testRootLibraryMirror, ' | 161 'testRootLibraryMirror, ' |
| 162 'testStringInstanceMirror]', | 162 'testStringInstanceMirror]', |
| 163 '$keys'); | 163 '$keys'); |
| 164 | 164 |
| 165 // Check that the classes map is complete. | 165 // Check that the classes map is complete. |
| 166 keys = lib_mirror.classes.keys; | 166 keys = lib_mirror.classes.keys.toList(); |
| 167 sort(keys); | 167 sort(keys); |
| 168 Expect.equals('[' | 168 Expect.equals('[' |
| 169 'FuncType, ' | 169 'FuncType, ' |
| 170 'GenericClass, ' | 170 'GenericClass, ' |
| 171 'MyClass, ' | 171 'MyClass, ' |
| 172 'MyException, ' | 172 'MyException, ' |
| 173 'MyInterface, ' | 173 'MyInterface, ' |
| 174 'MySuperClass]', | 174 'MySuperClass]', |
| 175 '$keys'); | 175 '$keys'); |
| 176 | 176 |
| 177 // Check that the functions map is complete. | 177 // Check that the functions map is complete. |
| 178 keys = lib_mirror.functions.keys; | 178 keys = lib_mirror.functions.keys.toList(); |
| 179 sort(keys); | 179 sort(keys); |
| 180 Expect.equals('[' | 180 Expect.equals('[' |
| 181 '_stringCompare, ' | 181 '_stringCompare, ' |
| 182 'buildMethodString, ' | 182 'buildMethodString, ' |
| 183 'buildVariableString, ' | 183 'buildVariableString, ' |
| 184 'function, ' | 184 'function, ' |
| 185 'main, ' | 185 'main, ' |
| 186 'methodWithError, ' | 186 'methodWithError, ' |
| 187 'methodWithException, ' | 187 'methodWithException, ' |
| 188 'myVar, ' | 188 'myVar, ' |
| 189 'myVar=, ' | 189 'myVar=, ' |
| 190 'sort, ' | 190 'sort, ' |
| 191 'testBoolInstanceMirror, ' | 191 'testBoolInstanceMirror, ' |
| 192 'testCustomInstanceMirror, ' | 192 'testCustomInstanceMirror, ' |
| 193 'testDone, ' | 193 'testDone, ' |
| 194 'testIntegerInstanceMirror, ' | 194 'testIntegerInstanceMirror, ' |
| 195 'testLibrariesMap, ' | 195 'testLibrariesMap, ' |
| 196 'testMirrorErrors, ' | 196 'testMirrorErrors, ' |
| 197 'testMirrorSystem, ' | 197 'testMirrorSystem, ' |
| 198 'testNullInstanceMirror, ' | 198 'testNullInstanceMirror, ' |
| 199 'testRootLibraryMirror, ' | 199 'testRootLibraryMirror, ' |
| 200 'testStringInstanceMirror]', | 200 'testStringInstanceMirror]', |
| 201 '$keys'); | 201 '$keys'); |
| 202 | 202 |
| 203 // Check that the getters map is complete. | 203 // Check that the getters map is complete. |
| 204 keys = lib_mirror.getters.keys; | 204 keys = lib_mirror.getters.keys.toList(); |
| 205 sort(keys); | 205 sort(keys); |
| 206 Expect.equals('[myVar]', '$keys'); | 206 Expect.equals('[myVar]', '$keys'); |
| 207 | 207 |
| 208 // Check that the setters map is complete. | 208 // Check that the setters map is complete. |
| 209 keys = lib_mirror.setters.keys; | 209 keys = lib_mirror.setters.keys.toList(); |
| 210 sort(keys); | 210 sort(keys); |
| 211 Expect.equals('[myVar=]', '$keys'); | 211 Expect.equals('[myVar=]', '$keys'); |
| 212 | 212 |
| 213 // Check that the variables map is complete. | 213 // Check that the variables map is complete. |
| 214 keys = lib_mirror.variables.keys; | 214 keys = lib_mirror.variables.keys.toList(); |
| 215 sort(keys); | 215 sort(keys); |
| 216 Expect.equals('[' | 216 Expect.equals('[' |
| 217 'exit_port, ' | 217 'exit_port, ' |
| 218 'expectedTests, ' | 218 'expectedTests, ' |
| 219 'final_global_var, ' | 219 'final_global_var, ' |
| 220 'global_var, ' | 220 'global_var, ' |
| 221 'myFunc]', | 221 'myFunc]', |
| 222 '$keys'); | 222 '$keys'); |
| 223 | 223 |
| 224 ClassMirror cls_mirror = lib_mirror.members['MyClass']; | 224 ClassMirror cls_mirror = lib_mirror.members['MyClass']; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // Test that an isolate can reflect on itself. | 521 // Test that an isolate can reflect on itself. |
| 522 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 522 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
| 523 | 523 |
| 524 testIntegerInstanceMirror(reflect(1001)); | 524 testIntegerInstanceMirror(reflect(1001)); |
| 525 testStringInstanceMirror(reflect('This\nis\na\nString')); | 525 testStringInstanceMirror(reflect('This\nis\na\nString')); |
| 526 testBoolInstanceMirror(reflect(true)); | 526 testBoolInstanceMirror(reflect(true)); |
| 527 testNullInstanceMirror(reflect(null)); | 527 testNullInstanceMirror(reflect(null)); |
| 528 testCustomInstanceMirror(reflect(new MyClass(17))); | 528 testCustomInstanceMirror(reflect(new MyClass(17))); |
| 529 testMirrorErrors(currentMirrorSystem()); | 529 testMirrorErrors(currentMirrorSystem()); |
| 530 } | 530 } |
| OLD | NEW |