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

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

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 years, 3 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
Index: tests/compiler/dart2js/type_variable_bound_test.dart
diff --git a/tests/compiler/dart2js/type_variable_bound_test.dart b/tests/compiler/dart2js/type_variable_bound_test.dart
index 01761c499488d14dc2d9a8ef49c6066d678bb1b1..5c9b720dce54309d584f4319e7cd4bc89477b44d 100644
--- a/tests/compiler/dart2js/type_variable_bound_test.dart
+++ b/tests/compiler/dart2js/type_variable_bound_test.dart
@@ -2,110 +2,113 @@
// 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:async_helper/async_helper.dart";
import 'compiler_helper.dart';
import "package:expect/expect.dart";
-compile(String source) {
+Future compile(String source) {
Uri uri = Uri.parse('test:code');
var compiler = compilerFor(source, uri);
- compiler.runCompiler(uri);
- return compiler;
+ return compiler.runCompiler(uri).then((_) {
+ return compiler;
+ });
}
test1() {
- var compiler = compile(r"""
+ asyncTest(() => compile(r"""
class A<T extends T> {}
void main() {
new A();
}
-""");
-
- Expect.isFalse(compiler.compilationFailed);
- Expect.isTrue(compiler.errors.isEmpty,
- 'unexpected errors: ${compiler.errors}');
- Expect.equals(1, compiler.warnings.length,
- 'expected exactly one warning, but got ${compiler.warnings}');
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[0].message.kind);
- Expect.equals("T", compiler.warnings[0].node.toString());
+""").then((compiler) {
+ Expect.isFalse(compiler.compilationFailed);
+ Expect.isTrue(compiler.errors.isEmpty,
+ 'unexpected errors: ${compiler.errors}');
+ Expect.equals(1, compiler.warnings.length,
+ 'expected exactly one warning, but got ${compiler.warnings}');
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[0].message.kind);
+ Expect.equals("T", compiler.warnings[0].node.toString());
+ }));
}
test2() {
- var compiler = compile(r"""
+ asyncTest(() => compile(r"""
class B<T extends S, S extends T> {}
void main() {
new B();
}
-""");
-
- Expect.isFalse(compiler.compilationFailed);
- print(compiler.errors);
- Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
- Expect.equals(2, compiler.warnings.length,
- 'expected exactly one error, but got ${compiler.warnings}');
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[0].message.kind);
- Expect.equals("T", compiler.warnings[0].node.toString());
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[1].message.kind);
- Expect.equals("S", compiler.warnings[1].node.toString());
+""").then((compiler) {
+ Expect.isFalse(compiler.compilationFailed);
+ print(compiler.errors);
+ Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
+ Expect.equals(2, compiler.warnings.length,
+ 'expected exactly one error, but got ${compiler.warnings}');
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[0].message.kind);
+ Expect.equals("T", compiler.warnings[0].node.toString());
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[1].message.kind);
+ Expect.equals("S", compiler.warnings[1].node.toString());
+ }));
}
test3() {
- var compiler = compile(r"""
+ asyncTest(() => compile(r"""
class C<T extends S, S extends U, U extends T> {}
void main() {
new C();
}
-""");
-
- Expect.isFalse(compiler.compilationFailed);
- print(compiler.errors);
- Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
- Expect.equals(3, compiler.warnings.length,
- 'expected exactly one error, but got ${compiler.warnings}');
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[0].message.kind);
- Expect.equals("T", compiler.warnings[0].node.toString());
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[1].message.kind);
- Expect.equals("S", compiler.warnings[1].node.toString());
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[2].message.kind);
- Expect.equals("U", compiler.warnings[2].node.toString());
+""").then((compiler) {
+ Expect.isFalse(compiler.compilationFailed);
+ print(compiler.errors);
+ Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
+ Expect.equals(3, compiler.warnings.length,
+ 'expected exactly one error, but got ${compiler.warnings}');
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[0].message.kind);
+ Expect.equals("T", compiler.warnings[0].node.toString());
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[1].message.kind);
+ Expect.equals("S", compiler.warnings[1].node.toString());
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[2].message.kind);
+ Expect.equals("U", compiler.warnings[2].node.toString());
+ }));
}
test4() {
- var compiler = compile(r"""
+ asyncTest(() => compile(r"""
class D<T extends S, S extends U, U extends S> {}
void main() {
new D();
}
-""");
-
- Expect.isFalse(compiler.compilationFailed);
- print(compiler.errors);
- Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
- Expect.equals(2, compiler.warnings.length,
- 'expected exactly one error, but got ${compiler.warnings}');
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[0].message.kind);
- Expect.equals("S", compiler.warnings[0].node.toString());
-
- Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
- compiler.warnings[1].message.kind);
- Expect.equals("U", compiler.warnings[1].node.toString());
+""").then((compiler) {
+ Expect.isFalse(compiler.compilationFailed);
+ print(compiler.errors);
+ Expect.isTrue(compiler.errors.isEmpty, 'unexpected errors');
+ Expect.equals(2, compiler.warnings.length,
+ 'expected exactly one error, but got ${compiler.warnings}');
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[0].message.kind);
+ Expect.equals("S", compiler.warnings[0].node.toString());
+
+ Expect.equals(MessageKind.CYCLIC_TYPE_VARIABLE,
+ compiler.warnings[1].message.kind);
+ Expect.equals("U", compiler.warnings[1].node.toString());
+ }));
}
main() {
« no previous file with comments | « tests/compiler/dart2js/type_test_helper.dart ('k') | tests/compiler/dart2js/type_variable_occurrence_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698