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

Unified Diff: tests/compiler/dart2js/compiler_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/compiler_helper.dart ('k') | tests/compiler/dart2js/constant_folding_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/compiler_test.dart
diff --git a/tests/compiler/dart2js/compiler_test.dart b/tests/compiler/dart2js/compiler_test.dart
index 8415ee83d49e0ffc82a10b3d598b99233819df74..4628772e011608a524128a39f24bde1300abad36 100644
--- a/tests/compiler/dart2js/compiler_test.dart
+++ b/tests/compiler/dart2js/compiler_test.dart
@@ -2,17 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import "dart:async";
import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart";
import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart";
import "../../../sdk/lib/_internal/compiler/implementation/resolution/resolution.dart";
-import "../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart";
import "../../../sdk/lib/_internal/compiler/implementation/util/util.dart";
import "mock_compiler.dart";
-import "parser_helper.dart";
+
class CallbackMockCompiler extends MockCompiler {
- CallbackMockCompiler();
+ CallbackMockCompiler() : super.internal();
var onError;
var onWarning;
@@ -39,19 +40,21 @@ class CallbackMockCompiler extends MockCompiler {
}
}
-testErrorHandling() {
+Future testErrorHandling() {
// Test that compiler.currentElement is set correctly when
// reporting errors/warnings.
CallbackMockCompiler compiler = new CallbackMockCompiler();
- ResolverVisitor visitor = compiler.resolverVisitor();
- compiler.parseScript('NoSuchPrefix.NoSuchType foo() {}');
- FunctionElement foo = compiler.mainApp.find('foo');
- compiler.setOnWarning(
- (c, n, m) => Expect.equals(foo, compiler.currentElement));
- foo.computeType(compiler);
- Expect.equals(1, compiler.warnings.length);
+ return compiler.init().then((_) {
+ ResolverVisitor visitor = compiler.resolverVisitor();
+ compiler.parseScript('NoSuchPrefix.NoSuchType foo() {}');
+ FunctionElement foo = compiler.mainApp.find('foo');
+ compiler.setOnWarning(
+ (c, n, m) => Expect.equals(foo, compiler.currentElement));
+ foo.computeType(compiler);
+ Expect.equals(1, compiler.warnings.length);
+ });
}
main() {
- testErrorHandling();
+ asyncTest(() => testErrorHandling());
}
« no previous file with comments | « tests/compiler/dart2js/compiler_helper.dart ('k') | tests/compiler/dart2js/constant_folding_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698