Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: runtime/tests/vm/dart/isolate_mirror_local_test.dart

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 471 }
472 472
473 void testMirrorErrors(MirrorSystem mirrors) { 473 void testMirrorErrors(MirrorSystem mirrors) {
474 LibraryMirror lib_mirror = mirrors.isolate.rootLibrary; 474 LibraryMirror lib_mirror = mirrors.isolate.rootLibrary;
475 475
476 lib_mirror.invokeAsync(const Symbol('methodWithException'), []) 476 lib_mirror.invokeAsync(const Symbol('methodWithException'), [])
477 .then((InstanceMirror retval) { 477 .then((InstanceMirror retval) {
478 // Should not reach here. 478 // Should not reach here.
479 Expect.isTrue(false); 479 Expect.isTrue(false);
480 }) 480 })
481 .catchError((exc) { 481 .catchError((error) {
482 Expect.isTrue(exc.error is MirroredUncaughtExceptionError); 482 Expect.isTrue(error is MirroredUncaughtExceptionError);
483 Expect.equals(const Symbol('MyException'), 483 Expect.equals(const Symbol('MyException'),
484 exc.error.exception_mirror.type.simpleName); 484 error.exception_mirror.type.simpleName);
485 Expect.equals('MyException: from methodWithException', 485 Expect.equals('MyException: from methodWithException',
486 exc.error.exception_string); 486 error.exception_string);
487 Expect.isTrue(exc.error.stacktrace.toString().contains( 487 Expect.isTrue(error.stacktrace.toString().contains(
488 'isolate_mirror_local_test.dart')); 488 'isolate_mirror_local_test.dart'));
489 testDone('testMirrorErrors1'); 489 testDone('testMirrorErrors1');
490 }); 490 });
491 491
492 lib_mirror.invokeAsync(const Symbol('methodWithError'), []) 492 lib_mirror.invokeAsync(const Symbol('methodWithError'), [])
493 .then((InstanceMirror retval) { 493 .then((InstanceMirror retval) {
494 // Should not reach here. 494 // Should not reach here.
495 Expect.isTrue(false); 495 Expect.isTrue(false);
496 }) 496 })
497 .catchError((exc) { 497 .catchError((error) {
498 Expect.isTrue(exc.error is MirroredCompilationError); 498 Expect.isTrue(error is MirroredCompilationError);
499 Expect.isTrue(exc.error.message.contains('unexpected token')); 499 Expect.isTrue(error.message.contains('unexpected token'));
500 testDone('testMirrorErrors2'); 500 testDone('testMirrorErrors2');
501 }); 501 });
502 502
503 // TODO(turnidge): When we call a method that doesn't exist, we 503 // TODO(turnidge): When we call a method that doesn't exist, we
504 // should probably call noSuchMethod(). I'm adding this test to 504 // should probably call noSuchMethod(). I'm adding this test to
505 // document the current behavior in the meantime. 505 // document the current behavior in the meantime.
506 lib_mirror.invokeAsync(const Symbol('methodNotFound'), []) 506 lib_mirror.invokeAsync(const Symbol('methodNotFound'), [])
507 .then((InstanceMirror retval) { 507 .then((InstanceMirror retval) {
508 // Should not reach here. 508 // Should not reach here.
509 Expect.isTrue(false); 509 Expect.isTrue(false);
510 }) 510 })
511 .catchError((exc) { 511 .catchError((error) {
512 Expect.isTrue(exc.error is MirroredCompilationError); 512 Expect.isTrue(error is MirroredCompilationError);
513 Expect.isTrue(exc.error.message.contains( 513 Expect.isTrue(error.message.contains(
514 "did not find top-level function 'methodNotFound'")); 514 "did not find top-level function 'methodNotFound'"));
515 testDone('testMirrorErrors3'); 515 testDone('testMirrorErrors3');
516 }); 516 });
517 } 517 }
518 518
519 void main() { 519 void main() {
520 // When all of the expected tests complete, the exit_port is closed, 520 // When all of the expected tests complete, the exit_port is closed,
521 // allowing the program to terminate. 521 // allowing the program to terminate.
522 exit_port = new ReceivePort(); 522 exit_port = new ReceivePort();
523 expectedTests = new Set<String>.from(['testRootLibraryMirror', 523 expectedTests = new Set<String>.from(['testRootLibraryMirror',
(...skipping 11 matching lines...) Expand all
535 // Test that an isolate can reflect on itself. 535 // Test that an isolate can reflect on itself.
536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); 536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem);
537 537
538 testIntegerInstanceMirror(reflect(1001)); 538 testIntegerInstanceMirror(reflect(1001));
539 testStringInstanceMirror(reflect('This\nis\na\nString')); 539 testStringInstanceMirror(reflect('This\nis\na\nString'));
540 testBoolInstanceMirror(reflect(true)); 540 testBoolInstanceMirror(reflect(true));
541 testNullInstanceMirror(reflect(null)); 541 testNullInstanceMirror(reflect(null));
542 testCustomInstanceMirror(reflect(new MyClass(17))); 542 testCustomInstanceMirror(reflect(new MyClass(17)));
543 testMirrorErrors(currentMirrorSystem()); 543 testMirrorErrors(currentMirrorSystem());
544 } 544 }
OLDNEW
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698