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

Unified Diff: test/runner/signal_test.dart

Issue 1400743002: Add support for setUpAll and tearDownAll. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 2 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 | « test/runner/set_up_all_test.dart ('k') | test/runner/tear_down_all_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/signal_test.dart
diff --git a/test/runner/signal_test.dart b/test/runner/signal_test.dart
index 5397d0767b42e9abd8dfc62b79605c65ea010bd1..63e8e7bd22d7e5dea8e489607de5e99548e92ea0 100644
--- a/test/runner/signal_test.dart
+++ b/test/runner/signal_test.dart
@@ -82,7 +82,11 @@ import 'dart:io';
import 'package:test/test.dart';
void main() {
- tearDown(() => new File("output").writeAsStringSync("ran teardown"));
+ tearDownAll(() {
+ new File("output_all").writeAsStringSync("ran tearDownAll");
+ });
+
+ tearDown(() => new File("output").writeAsStringSync("ran tearDown"));
test("test", () {
print("running test");
@@ -95,7 +99,34 @@ void main() {
test.stdout.expect(consumeThrough("running test"));
signalAndQuit(test);
- d.file("output", "ran teardown").validate();
+ d.file("output", "ran tearDown").validate();
+ d.file("output_all", "ran tearDownAll").validate();
+ expectTempDirEmpty();
+ });
+
+ test("waits for an active tearDownAll to finish running", () {
+ d.file("test.dart", """
+import 'dart:async';
+import 'dart:io';
+
+import 'package:test/test.dart';
+
+void main() {
+ tearDownAll(() async {
+ print("running tearDownAll");
+ await new Future.delayed(new Duration(seconds: 1));
+ new File("output").writeAsStringSync("ran tearDownAll");
+ });
+
+ test("test", () {});
+}
+""").create();
+
+ var test = _runTest(["test.dart"]);
+ test.stdout.expect(consumeThrough("running tearDownAll"));
+ signalAndQuit(test);
+
+ d.file("output", "ran tearDownAll").validate();
expectTempDirEmpty();
});
« no previous file with comments | « test/runner/set_up_all_test.dart ('k') | test/runner/tear_down_all_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698