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

Unified Diff: tests/compiler/dart2js/closure_codegen_test.dart

Issue 326913002: Make dart2js unittests async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 6 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 | « tests/compiler/dart2js/builtin_interceptor_test.dart ('k') | tests/compiler/dart2js/code_motion_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/closure_codegen_test.dart
diff --git a/tests/compiler/dart2js/closure_codegen_test.dart b/tests/compiler/dart2js/closure_codegen_test.dart
index e3f9f4a509c8e161889a5519d6ca10c94fc60e49..d9d05d61ca201bef774446e3a9f060da687ca4df 100644
--- a/tests/compiler/dart2js/closure_codegen_test.dart
+++ b/tests/compiler/dart2js/closure_codegen_test.dart
@@ -3,10 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
// Test that parameters keep their names in the output.
-import "package:expect/expect.dart";
-import "package:async_helper/async_helper.dart";
+import 'dart:async';
+import 'package:expect/expect.dart';
+import 'package:async_helper/async_helper.dart';
import 'compiler_helper.dart';
-import 'parser_helper.dart';
const String TEST_INVOCATION0 = r"""
main() {
@@ -41,29 +41,35 @@ class A {
main() { new A().foo(1); }
""";
-closureInvocation(bool minify, String prefix) {
- String generated = compile(TEST_INVOCATION0, minify: minify);
- Expect.isTrue(generated.contains(".$prefix\$0()"));
- generated = compile(TEST_INVOCATION1, minify: minify);
- Expect.isTrue(generated.contains(".$prefix\$1(1)"));
- generated = compile(TEST_INVOCATION2, minify: minify);
- Expect.isTrue(generated.contains(".$prefix\$2(1,${minify ? "" : " "}2)"));
+Future closureInvocation(bool minify, String prefix) {
+ return Future.wait([
+ compile(TEST_INVOCATION0, minify: minify, check: (String generated) {
+ Expect.isTrue(generated.contains(".$prefix\$0()"));
+ }),
+ compile(TEST_INVOCATION1, minify: minify, check: (String generated) {
+ Expect.isTrue(generated.contains(".$prefix\$1(1)"));
+ }),
+ compile(TEST_INVOCATION2, minify: minify, check: (String generated) {
+ Expect.isTrue(generated.contains(".$prefix\$2(1,${minify ? "" : " "}2)"));
+ })
+ ]);
}
// Make sure that the bailout version does not introduce a second version of
// the closure.
-closureBailout(bool minify, String prefix) {
- asyncTest(() => compileAll(TEST_BAILOUT, minify: minify)
- .then((generated) {
+Future closureBailout(bool minify, String prefix) {
+ return compileAll(TEST_BAILOUT, minify: minify).then((generated) {
RegExp regexp = new RegExp("$prefix\\\$0:${minify ? "" : " "}function");
Iterator<Match> matches = regexp.allMatches(generated).iterator;
checkNumberOfMatches(matches, 1);
- }));
+ });
}
main() {
- closureInvocation(false, "call");
- closureInvocation(true, "");
- closureBailout(false, "call");
- closureBailout(true, "");
+ asyncTest(() => Future.wait([
+ closureInvocation(false, "call"),
+ closureInvocation(true, ""),
+ closureBailout(false, "call"),
+ closureBailout(true, ""),
+ ]));
}
« no previous file with comments | « tests/compiler/dart2js/builtin_interceptor_test.dart ('k') | tests/compiler/dart2js/code_motion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698