| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 void testBoolInstanceMirror(InstanceMirror mirror) { | 384 void testBoolInstanceMirror(InstanceMirror mirror) { |
| 385 Expect.equals(const Symbol('bool'), mirror.type.simpleName); | 385 Expect.equals(const Symbol('bool'), mirror.type.simpleName); |
| 386 Expect.isTrue(mirror.hasReflectee); | 386 Expect.isTrue(mirror.hasReflectee); |
| 387 Expect.equals(true, mirror.reflectee); | 387 Expect.equals(true, mirror.reflectee); |
| 388 Expect.equals("InstanceMirror on true", mirror.toString()); | 388 Expect.equals("InstanceMirror on true", mirror.toString()); |
| 389 testDone('testBoolInstanceMirror'); | 389 testDone('testBoolInstanceMirror'); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void testNullInstanceMirror(InstanceMirror mirror) { | 392 void testNullInstanceMirror(InstanceMirror mirror) { |
| 393 // TODO(turnidge): This is returning the wrong class. Fix it. | 393 Expect.equals(const Symbol('Null'), mirror.type.simpleName); |
| 394 Expect.equals(const Symbol('Object'), mirror.type.simpleName); | |
| 395 Expect.isTrue(mirror.hasReflectee); | 394 Expect.isTrue(mirror.hasReflectee); |
| 396 Expect.equals(null, mirror.reflectee); | 395 Expect.equals(null, mirror.reflectee); |
| 397 Expect.equals("InstanceMirror on null", mirror.toString()); | 396 Expect.equals("InstanceMirror on null", mirror.toString()); |
| 398 testDone('testNullInstanceMirror'); | 397 testDone('testNullInstanceMirror'); |
| 399 } | 398 } |
| 400 | 399 |
| 401 class MySuperClass { | 400 class MySuperClass { |
| 402 } | 401 } |
| 403 | 402 |
| 404 class MyInterface { | 403 class MyInterface { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // Test that an isolate can reflect on itself. | 534 // Test that an isolate can reflect on itself. |
| 536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 535 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
| 537 | 536 |
| 538 testIntegerInstanceMirror(reflect(1001)); | 537 testIntegerInstanceMirror(reflect(1001)); |
| 539 testStringInstanceMirror(reflect('This\nis\na\nString')); | 538 testStringInstanceMirror(reflect('This\nis\na\nString')); |
| 540 testBoolInstanceMirror(reflect(true)); | 539 testBoolInstanceMirror(reflect(true)); |
| 541 testNullInstanceMirror(reflect(null)); | 540 testNullInstanceMirror(reflect(null)); |
| 542 testCustomInstanceMirror(reflect(new MyClass(17))); | 541 testCustomInstanceMirror(reflect(new MyClass(17))); |
| 543 testMirrorErrors(currentMirrorSystem()); | 542 testMirrorErrors(currentMirrorSystem()); |
| 544 } | 543 } |
| OLD | NEW |