| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. | 320 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. |
| 321 // Expect.equals("ClassMirror on 'List'", list_intf.toString()); | 321 // Expect.equals("ClassMirror on 'List'", list_intf.toString()); |
| 322 | 322 |
| 323 // Lookup a class from a library and make sure it is sane. | 323 // Lookup a class from a library and make sure it is sane. |
| 324 ClassMirror oom_cls = core_lib.members[const Symbol('OutOfMemoryError')]; | 324 ClassMirror oom_cls = core_lib.members[const Symbol('OutOfMemoryError')]; |
| 325 Expect.isTrue(oom_cls is ClassMirror); | 325 Expect.isTrue(oom_cls is ClassMirror); |
| 326 Expect.equals(const Symbol('OutOfMemoryError'), oom_cls.simpleName); | 326 Expect.equals(const Symbol('OutOfMemoryError'), oom_cls.simpleName); |
| 327 Expect.equals(const Symbol('dart.core.OutOfMemoryError'), | 327 Expect.equals(const Symbol('dart.core.OutOfMemoryError'), |
| 328 oom_cls.qualifiedName); | 328 oom_cls.qualifiedName); |
| 329 Expect.isFalse(oom_cls.isPrivate); | 329 Expect.isFalse(oom_cls.isPrivate); |
| 330 Expect.equals(const Symbol('Error'), oom_cls.superclass.simpleName); | 330 Expect.equals(const Symbol('Object'), oom_cls.superclass.simpleName); |
| 331 Expect.isTrue(oom_cls.defaultFactory == null); | 331 Expect.isTrue(oom_cls.defaultFactory == null); |
| 332 Expect.equals(const Symbol('dart.core'), oom_cls.owner.simpleName); | 332 Expect.equals(const Symbol('dart.core'), oom_cls.owner.simpleName); |
| 333 Expect.isTrue(oom_cls.isClass); | 333 Expect.isTrue(oom_cls.isClass); |
| 334 Expect.isTrue(oom_cls.superinterfaces.isEmpty); | 334 Expect.equals(const Symbol('Error'), oom_cls.superinterfaces[0].simpleName); |
| 335 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. | 335 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. |
| 336 // Expect.equals("ClassMirror on 'OutOfMemoryError'", | 336 // Expect.equals("ClassMirror on 'OutOfMemoryError'", |
| 337 // oom_cls.toString()); | 337 // oom_cls.toString()); |
| 338 testDone('testLibrariesMap'); | 338 testDone('testLibrariesMap'); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void testMirrorSystem(MirrorSystem mirrors) { | 341 void testMirrorSystem(MirrorSystem mirrors) { |
| 342 Expect.isTrue(mirrors.isolate.debugName.contains('main')); | 342 Expect.isTrue(mirrors.isolate.debugName.contains('main')); |
| 343 testRootLibraryMirror(mirrors.isolate.rootLibrary); | 343 testRootLibraryMirror(mirrors.isolate.rootLibrary); |
| 344 testLibrariesMap(mirrors.libraries); | 344 testLibrariesMap(mirrors.libraries); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // Test that an isolate can reflect on itself. | 539 // Test that an isolate can reflect on itself. |
| 540 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 540 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
| 541 | 541 |
| 542 testIntegerInstanceMirror(reflect(1001)); | 542 testIntegerInstanceMirror(reflect(1001)); |
| 543 testStringInstanceMirror(reflect('This\nis\na\nString')); | 543 testStringInstanceMirror(reflect('This\nis\na\nString')); |
| 544 testBoolInstanceMirror(reflect(true)); | 544 testBoolInstanceMirror(reflect(true)); |
| 545 testNullInstanceMirror(reflect(null)); | 545 testNullInstanceMirror(reflect(null)); |
| 546 testCustomInstanceMirror(reflect(new MyClass(17))); | 546 testCustomInstanceMirror(reflect(new MyClass(17))); |
| 547 testMirrorErrors(currentMirrorSystem()); | 547 testMirrorErrors(currentMirrorSystem()); |
| 548 } | 548 } |
| OLD | NEW |