| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 345 Expect.equals(const Symbol('void'), mirrors.voidType.simpleName); | 345 Expect.equals(const Symbol('void'), mirrors.voidType.simpleName); |
| 346 Expect.equals(const Symbol('dynamic'), mirrors.dynamicType.simpleName); | 346 Expect.equals(const Symbol('dynamic'), mirrors.dynamicType.simpleName); |
| 347 Expect.isTrue(mirrors.voidType is TypeMirror); |
| 348 Expect.isTrue(mirrors.dynamicType is TypeMirror); |
| 349 Expect.isFalse(mirrors.voidType is ClassMirror); |
| 350 Expect.isFalse(mirrors.dynamicType is ClassMirror); |
| 347 testDone('testMirrorSystem'); | 351 testDone('testMirrorSystem'); |
| 348 } | 352 } |
| 349 | 353 |
| 350 void testIntegerInstanceMirror(InstanceMirror mirror) { | 354 void testIntegerInstanceMirror(InstanceMirror mirror) { |
| 351 Expect.equals(const Symbol('int'), mirror.type.simpleName); | 355 Expect.equals(const Symbol('int'), mirror.type.simpleName); |
| 352 Expect.isTrue(mirror.hasReflectee); | 356 Expect.isTrue(mirror.hasReflectee); |
| 353 Expect.equals(1001, mirror.reflectee); | 357 Expect.equals(1001, mirror.reflectee); |
| 354 Expect.equals("InstanceMirror on 1001", mirror.toString()); | 358 Expect.equals("InstanceMirror on 1001", mirror.toString()); |
| 355 | 359 |
| 356 // Invoke (mirror + mirror). | 360 // Invoke (mirror + mirror). |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // Test that an isolate can reflect on itself. | 539 // Test that an isolate can reflect on itself. |
| 536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 540 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
| 537 | 541 |
| 538 testIntegerInstanceMirror(reflect(1001)); | 542 testIntegerInstanceMirror(reflect(1001)); |
| 539 testStringInstanceMirror(reflect('This\nis\na\nString')); | 543 testStringInstanceMirror(reflect('This\nis\na\nString')); |
| 540 testBoolInstanceMirror(reflect(true)); | 544 testBoolInstanceMirror(reflect(true)); |
| 541 testNullInstanceMirror(reflect(null)); | 545 testNullInstanceMirror(reflect(null)); |
| 542 testCustomInstanceMirror(reflect(new MyClass(17))); | 546 testCustomInstanceMirror(reflect(new MyClass(17))); |
| 543 testMirrorErrors(currentMirrorSystem()); | 547 testMirrorErrors(currentMirrorSystem()); |
| 544 } | 548 } |
| OLD | NEW |