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

Unified Diff: test/runner/browser/loader_test.dart

Issue 1107743002: Support asynchronous main methods. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 8 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 | « pubspec.yaml ('k') | test/runner/isolate_listener_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/browser/loader_test.dart
diff --git a/test/runner/browser/loader_test.dart b/test/runner/browser/loader_test.dart
index fbf549cc4a66fbb6295ac23c89f956791a509d00..9dd4f62747ef242d176a6ecccf0360692ee55466 100644
--- a/test/runner/browser/loader_test.dart
+++ b/test/runner/browser/loader_test.dart
@@ -88,6 +88,39 @@ void main() {
});
});
+
+ test("loads tests that are defined asynchronously", () {
+ new File(p.join(_sandbox, 'a_test.dart')).writeAsStringSync("""
+import 'dart:async';
+
+import 'package:test/test.dart';
+
+Future main() {
+ return new Future(() {
+ test("success", () {});
+
+ return new Future(() {
+ test("failure", () => throw new TestFailure('oh no'));
+
+ return new Future(() {
+ test("error", () => throw 'oh no');
+ });
+ });
+ });
+}
+""");
+
+ return _loader.loadFile(p.join(_sandbox, 'a_test.dart')).toList()
+ .then((suites) {
+ expect(suites, hasLength(1));
+ var suite = suites.first;
+ expect(suite.tests, hasLength(3));
+ expect(suite.tests[0].name, equals("success"));
+ expect(suite.tests[1].name, equals("failure"));
+ expect(suite.tests[2].name, equals("error"));
+ });
+ });
+
test("loads a suite both in the browser and the VM", () {
var loader = new Loader([TestPlatform.vm, TestPlatform.chrome],
root: _sandbox,
« no previous file with comments | « pubspec.yaml ('k') | test/runner/isolate_listener_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698