| 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 506 |
| 507 // TODO(turnidge): When we call a method that doesn't exist, we | 507 // TODO(turnidge): When we call a method that doesn't exist, we |
| 508 // should probably call noSuchMethod(). I'm adding this test to | 508 // should probably call noSuchMethod(). I'm adding this test to |
| 509 // document the current behavior in the meantime. | 509 // document the current behavior in the meantime. |
| 510 lib_mirror.invokeAsync(const Symbol('methodNotFound'), []) | 510 lib_mirror.invokeAsync(const Symbol('methodNotFound'), []) |
| 511 .then((InstanceMirror retval) { | 511 .then((InstanceMirror retval) { |
| 512 // Should not reach here. | 512 // Should not reach here. |
| 513 Expect.isTrue(false); | 513 Expect.isTrue(false); |
| 514 }) | 514 }) |
| 515 .catchError((error) { | 515 .catchError((error) { |
| 516 Expect.isTrue(error is MirroredCompilationError); | 516 Expect.isTrue(error is NoSuchMethodError); |
| 517 Expect.isTrue(error.message.contains( | 517 Expect.isTrue(error.toString().contains( |
| 518 "did not find top-level function 'methodNotFound'")); | 518 "No top-level method 'methodNotFound'")); |
| 519 testDone('testMirrorErrors3'); | 519 testDone('testMirrorErrors3'); |
| 520 }); | 520 }); |
| 521 } | 521 } |
| 522 | 522 |
| 523 void main() { | 523 void main() { |
| 524 // When all of the expected tests complete, the exit_port is closed, | 524 // When all of the expected tests complete, the exit_port is closed, |
| 525 // allowing the program to terminate. | 525 // allowing the program to terminate. |
| 526 exit_port = new ReceivePort(); | 526 exit_port = new ReceivePort(); |
| 527 expectedTests = new Set<String>.from(['testRootLibraryMirror', | 527 expectedTests = new Set<String>.from(['testRootLibraryMirror', |
| 528 'testLibrariesMap', | 528 'testLibrariesMap', |
| (...skipping 10 matching lines...) Expand all 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 |