Chromium Code Reviews| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 | 476 |
| 477 void testMirrorErrors(MirrorSystem mirrors) { | 477 void testMirrorErrors(MirrorSystem mirrors) { |
| 478 LibraryMirror lib_mirror = mirrors.isolate.rootLibrary; | 478 LibraryMirror lib_mirror = mirrors.isolate.rootLibrary; |
| 479 | 479 |
| 480 lib_mirror.invokeAsync(const Symbol('methodWithException'), []) | 480 lib_mirror.invokeAsync(const Symbol('methodWithException'), []) |
| 481 .then((InstanceMirror retval) { | 481 .then((InstanceMirror retval) { |
| 482 // Should not reach here. | 482 // Should not reach here. |
| 483 Expect.isTrue(false); | 483 Expect.isTrue(false); |
| 484 }) | 484 }) |
| 485 .catchError((error) { | 485 .catchError((error) { |
| 486 Expect.isTrue(error is MirroredUncaughtExceptionError); | 486 Expect.isTrue(error is MyException); |
| 487 Expect.equals(const Symbol('MyException'), | |
| 488 error.exception_mirror.type.simpleName); | |
| 489 Expect.equals('MyException: from methodWithException', | 487 Expect.equals('MyException: from methodWithException', |
| 490 error.exception_string); | 488 error.toString()); |
| 491 Expect.isTrue(error.stacktrace.toString().contains( | |
|
rmacnak
2013/07/24 02:52:45
We don't have stack traces by default anymore, and
| |
| 492 'isolate_mirror_local_test.dart')); | |
| 493 testDone('testMirrorErrors1'); | 489 testDone('testMirrorErrors1'); |
| 494 }); | 490 }); |
| 495 | 491 |
| 496 lib_mirror.invokeAsync(const Symbol('methodWithError'), []) | 492 lib_mirror.invokeAsync(const Symbol('methodWithError'), []) |
| 497 .then((InstanceMirror retval) { | 493 .then((InstanceMirror retval) { |
| 498 // Should not reach here. | 494 // Should not reach here. |
| 499 Expect.isTrue(false); | 495 Expect.isTrue(false); |
| 500 }) | 496 }) |
| 501 .catchError((error) { | 497 .catchError((error) { |
| 502 Expect.isTrue(error is MirroredCompilationError); | 498 Expect.isTrue(error is MirroredCompilationError); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 // Test that an isolate can reflect on itself. | 535 // Test that an isolate can reflect on itself. |
| 540 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); | 536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); |
| 541 | 537 |
| 542 testIntegerInstanceMirror(reflect(1001)); | 538 testIntegerInstanceMirror(reflect(1001)); |
| 543 testStringInstanceMirror(reflect('This\nis\na\nString')); | 539 testStringInstanceMirror(reflect('This\nis\na\nString')); |
| 544 testBoolInstanceMirror(reflect(true)); | 540 testBoolInstanceMirror(reflect(true)); |
| 545 testNullInstanceMirror(reflect(null)); | 541 testNullInstanceMirror(reflect(null)); |
| 546 testCustomInstanceMirror(reflect(new MyClass(17))); | 542 testCustomInstanceMirror(reflect(new MyClass(17))); |
| 547 testMirrorErrors(currentMirrorSystem()); | 543 testMirrorErrors(currentMirrorSystem()); |
| 548 } | 544 } |
| OLD | NEW |