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

Unified Diff: runtime/tests/vm/dart/isolate_mirror_local_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/timer_patch.dart ('k') | runtime/tests/vm/dart/isolate_unhandled_exception_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/tests/vm/dart/isolate_mirror_local_test.dart
diff --git a/runtime/tests/vm/dart/isolate_mirror_local_test.dart b/runtime/tests/vm/dart/isolate_mirror_local_test.dart
index d4b8b88b8cc8d21a3f7cbb0463d1e90a580adc7a..26bc3ddf50e590ed1c36a9e8c2a2a2b78632a7a0 100644
--- a/runtime/tests/vm/dart/isolate_mirror_local_test.dart
+++ b/runtime/tests/vm/dart/isolate_mirror_local_test.dart
@@ -9,6 +9,7 @@
library isolate_mirror_local_test;
+import 'dart:async';
import 'dart:isolate';
import 'dart:mirrors';
@@ -125,7 +126,7 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
});
// Check that the members map is complete.
- List keys = lib_mirror.members.keys;
+ List keys = lib_mirror.members.keys.toList();
sort(keys);
Expect.equals('['
'FuncType, '
@@ -162,7 +163,7 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
'$keys');
// Check that the classes map is complete.
- keys = lib_mirror.classes.keys;
+ keys = lib_mirror.classes.keys.toList();
sort(keys);
Expect.equals('['
'FuncType, '
@@ -174,7 +175,7 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
'$keys');
// Check that the functions map is complete.
- keys = lib_mirror.functions.keys;
+ keys = lib_mirror.functions.keys.toList();
sort(keys);
Expect.equals('['
'_stringCompare, '
@@ -200,17 +201,17 @@ void testRootLibraryMirror(LibraryMirror lib_mirror) {
'$keys');
// Check that the getters map is complete.
- keys = lib_mirror.getters.keys;
+ keys = lib_mirror.getters.keys.toList();
sort(keys);
Expect.equals('[myVar]', '$keys');
// Check that the setters map is complete.
- keys = lib_mirror.setters.keys;
+ keys = lib_mirror.setters.keys.toList();
sort(keys);
Expect.equals('[myVar=]', '$keys');
// Check that the variables map is complete.
- keys = lib_mirror.variables.keys;
+ keys = lib_mirror.variables.keys.toList();
sort(keys);
Expect.equals('['
'exit_port, '
@@ -458,59 +459,47 @@ void methodWithError() {
void testMirrorErrors(MirrorSystem mirrors) {
LibraryMirror lib_mirror = mirrors.isolate.rootLibrary;
- Future<InstanceMirror> future =
- lib_mirror.invoke('methodWithException', []);
- future.handleException(
- (MirroredError exc) {
- Expect.isTrue(exc is MirroredUncaughtExceptionError);
+ lib_mirror.invoke('methodWithException', [])
+ .then((InstanceMirror retval) {
+ // Should not reach here.
+ Expect.isTrue(false);
+ })
+ .catchError((exc) {
+ Expect.isTrue(exc.error is MirroredUncaughtExceptionError);
Expect.equals('MyException',
- exc.exception_mirror.type.simpleName);
+ exc.error.exception_mirror.type.simpleName);
Expect.equals('MyException: from methodWithException',
- exc.exception_string);
- Expect.isTrue(exc.stacktrace.toString().contains(
+ exc.error.exception_string);
+ Expect.isTrue(exc.error.stacktrace.toString().contains(
'isolate_mirror_local_test.dart'));
testDone('testMirrorErrors1');
- return true;
- });
- future.then(
- (InstanceMirror retval) {
- // Should not reach here.
- Expect.isTrue(false);
});
- Future<InstanceMirror> future2 =
- lib_mirror.invoke('methodWithError', []);
- future2.handleException(
- (MirroredError exc) {
- Expect.isTrue(exc is MirroredCompilationError);
- Expect.isTrue(exc.message.contains('unexpected token'));
- testDone('testMirrorErrors2');
- return true;
- });
- future2.then(
- (InstanceMirror retval) {
- // Should not reach here.
- Expect.isTrue(false);
- });
+ lib_mirror.invoke('methodWithError', [])
+ .then((InstanceMirror retval) {
+ // Should not reach here.
+ Expect.isTrue(false);
+ })
+ .catchError((exc) {
+ Expect.isTrue(exc.error is MirroredCompilationError);
+ Expect.isTrue(exc.error.message.contains('unexpected token'));
+ testDone('testMirrorErrors2');
+ });
// TODO(turnidge): When we call a method that doesn't exist, we
// should probably call noSuchMethod(). I'm adding this test to
// document the current behavior in the meantime.
- Future<InstanceMirror> future3 =
- lib_mirror.invoke('methodNotFound', []);
- future3.handleException(
- (MirroredError exc) {
- Expect.isTrue(exc is MirroredCompilationError);
- Expect.isTrue(exc.message.contains(
- "did not find top-level function 'methodNotFound'"));
- testDone('testMirrorErrors3');
- return true;
- });
- future3.then(
- (InstanceMirror retval) {
- // Should not reach here.
- Expect.isTrue(false);
- });
+ lib_mirror.invoke('methodNotFound', [])
+ .then((InstanceMirror retval) {
+ // Should not reach here.
+ Expect.isTrue(false);
+ })
+ .catchError((exc) {
+ Expect.isTrue(exc.error is MirroredCompilationError);
+ Expect.isTrue(exc.error.message.contains(
+ "did not find top-level function 'methodNotFound'"));
+ testDone('testMirrorErrors3');
+ });
}
void main() {
« no previous file with comments | « runtime/lib/timer_patch.dart ('k') | runtime/tests/vm/dart/isolate_unhandled_exception_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698