Index: tests/compiler/dart2js/mirror_helper_test.dart |
diff --git a/tests/compiler/dart2js/mirror_helper_test.dart b/tests/compiler/dart2js/mirror_helper_test.dart |
index cb22b11f79555ec61b5e15e72a5d47d8cfb2859e..4e574245fd88097787b0b4d7b3491332451f3ecd 100644 |
--- a/tests/compiler/dart2js/mirror_helper_test.dart |
+++ b/tests/compiler/dart2js/mirror_helper_test.dart |
@@ -3,6 +3,8 @@ |
// BSD-style license that can be found in the LICENSE file. |
import "package:expect/expect.dart"; |
+import 'dart:async'; |
+import '../../async_helper.dart'; |
import 'memory_compiler.dart' show compilerFor; |
import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show |
Compiler; |
@@ -35,7 +37,7 @@ main() { |
testWithoutMirrorRenaming(minify: false); |
} |
-Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) { |
+Future<Compiler> runCompiler({useMirrorHelperLibrary: false, minify: false}) { |
List<String> options = ['--output-type=dart']; |
if (minify) { |
options.add('--minify'); |
@@ -43,43 +45,46 @@ Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) { |
Compiler compiler = compilerFor(MEMORY_SOURCE_FILES, options: options); |
DartBackend backend = compiler.backend; |
backend.useMirrorHelperLibrary = useMirrorHelperLibrary; |
- compiler.runCompiler(Uri.parse('memory:main.dart')); |
- return compiler; |
+ return |
+ compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler); |
} |
void testWithMirrorRenaming({bool minify}) { |
- Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: minify); |
+ asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify). |
+ then((Compiler compiler) { |
- DartBackend backend = compiler.backend; |
- MirrorRenamer mirrorRenamer = backend.mirrorRenamer; |
- Map<Node, String> renames = backend.renames; |
- Map<LibraryElement, String> imports = backend.imports; |
+ DartBackend backend = compiler.backend; |
+ MirrorRenamer mirrorRenamer = backend.mirrorRenamer; |
+ Map<Node, String> renames = backend.renames; |
+ Map<LibraryElement, String> imports = backend.imports; |
- Node getNameFunctionNode = |
- backend.memberNodes.values.first.first.body.statements.nodes.head; |
+ Node getNameFunctionNode = |
+ backend.memberNodes.values.first.first.body.statements.nodes.head; |
- Expect.equals( |
- const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION), |
- mirrorRenamer.symbols[renames[getNameFunctionNode.expression.selector]]); |
- Expect.equals("", |
- renames[getNameFunctionNode.expression.receiver]); |
- Expect.equals(1, imports.keys.length); |
+ Expect.equals( |
+ const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION), |
+ mirrorRenamer.symbols[renames[getNameFunctionNode.expression.selector]]); |
+ Expect.equals("", |
+ renames[getNameFunctionNode.expression.receiver]); |
+ Expect.equals(1, imports.keys.length); |
+ })); |
} |
void testWithoutMirrorRenaming({bool minify}) { |
- Compiler compiler = |
- runCompiler(useMirrorHelperLibrary: false, minify: minify); |
+ asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify). |
+ then((Compiler compiler) { |
- DartBackend backend = compiler.backend; |
- Map<Node, String> renames = backend.renames; |
- Map<LibraryElement, String> imports = backend.imports; |
+ DartBackend backend = compiler.backend; |
+ Map<Node, String> renames = backend.renames; |
+ Map<LibraryElement, String> imports = backend.imports; |
- Node getNameFunctionNode = |
- backend.memberNodes.values.first.first.body.statements.nodes.head; |
+ Node getNameFunctionNode = |
+ backend.memberNodes.values.first.first.body.statements.nodes.head; |
- Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector)); |
- Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver)); |
- Expect.equals(1, imports.keys.length); |
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector)); |
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver)); |
+ Expect.equals(1, imports.keys.length); |
+ })); |
} |
const MEMORY_SOURCE_FILES = const <String, String> { |