| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 Expect.equals('dart:core.List', list_intf.qualifiedName); | 304 Expect.equals('dart:core.List', list_intf.qualifiedName); |
| 305 Expect.isFalse(list_intf.isPrivate); | 305 Expect.isFalse(list_intf.isPrivate); |
| 306 Expect.equals('Object', list_intf.superclass.simpleName); | 306 Expect.equals('Object', list_intf.superclass.simpleName); |
| 307 Expect.equals('ListImplementation', list_intf.defaultFactory.simpleName); | 307 Expect.equals('ListImplementation', list_intf.defaultFactory.simpleName); |
| 308 Expect.equals('dart:core', list_intf.owner.simpleName); | 308 Expect.equals('dart:core', list_intf.owner.simpleName); |
| 309 Expect.isFalse(list_intf.isClass); | 309 Expect.isFalse(list_intf.isClass); |
| 310 Expect.equals('Collection', list_intf.superinterfaces[0].simpleName); | 310 Expect.equals('Collection', list_intf.superinterfaces[0].simpleName); |
| 311 Expect.equals("ClassMirror on 'List'", list_intf.toString()); | 311 Expect.equals("ClassMirror on 'List'", list_intf.toString()); |
| 312 | 312 |
| 313 // Lookup a class from a library and make sure it is sane. | 313 // Lookup a class from a library and make sure it is sane. |
| 314 ClassMirror oom_cls = core_lib.members['OutOfMemoryException']; | 314 ClassMirror oom_cls = core_lib.members['OutOfMemoryError']; |
| 315 Expect.isTrue(oom_cls is ClassMirror); | 315 Expect.isTrue(oom_cls is ClassMirror); |
| 316 Expect.equals('OutOfMemoryException', oom_cls.simpleName); | 316 Expect.equals('OutOfMemoryError', oom_cls.simpleName); |
| 317 Expect.equals('dart:core.OutOfMemoryException', oom_cls.qualifiedName); | 317 Expect.equals('dart:core.OutOfMemoryError', oom_cls.qualifiedName); |
| 318 Expect.isFalse(oom_cls.isPrivate); | 318 Expect.isFalse(oom_cls.isPrivate); |
| 319 Expect.equals('Object', oom_cls.superclass.simpleName); | 319 Expect.equals('Object', oom_cls.superclass.simpleName); |
| 320 Expect.isTrue(oom_cls.defaultFactory === null); | 320 Expect.isTrue(oom_cls.defaultFactory === null); |
| 321 Expect.equals('dart:core', oom_cls.owner.simpleName); | 321 Expect.equals('dart:core', oom_cls.owner.simpleName); |
| 322 Expect.isTrue(oom_cls.isClass); | 322 Expect.isTrue(oom_cls.isClass); |
| 323 Expect.equals('Exception', oom_cls.superinterfaces[0].simpleName); | 323 Expect.equals('Exception', oom_cls.superinterfaces[0].simpleName); |
| 324 Expect.equals("ClassMirror on 'OutOfMemoryException'", | 324 Expect.equals("ClassMirror on 'OutOfMemoryError'", |
| 325 oom_cls.toString()); | 325 oom_cls.toString()); |
| 326 testDone('testLibrariesMap'); | 326 testDone('testLibrariesMap'); |
| 327 } | 327 } |
| 328 | 328 |
| 329 void testMirrorSystem(MirrorSystem mirrors) { | 329 void testMirrorSystem(MirrorSystem mirrors) { |
| 330 Expect.isTrue(mirrors.isolate.debugName.contains('main')); | 330 Expect.isTrue(mirrors.isolate.debugName.contains('main')); |
| 331 testRootLibraryMirror(mirrors.isolate.rootLibrary); | 331 testRootLibraryMirror(mirrors.isolate.rootLibrary); |
| 332 testLibrariesMap(mirrors.libraries); | 332 testLibrariesMap(mirrors.libraries); |
| 333 Expect.equals('void', mirrors.voidType.simpleName); | 333 Expect.equals('void', mirrors.voidType.simpleName); |
| 334 Expect.equals('Dynamic', mirrors.dynamicType.simpleName); | 334 Expect.equals('Dynamic', mirrors.dynamicType.simpleName); |
| (...skipping 198 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 |