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

Side by Side Diff: test/runner/tear_down_all_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 unified diff | Download patch
« no previous file with comments | « test/runner/signal_test.dart ('k') | test/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 @TestOn("vm")
6
7 import 'package:scheduled_test/descriptor.dart' as d;
8 import 'package:scheduled_test/scheduled_stream.dart';
9 import 'package:scheduled_test/scheduled_test.dart';
10
11 import '../io.dart';
12
13 void main() {
14 useSandbox();
15
16 test("an error causes the run to fail", () {
17 d.file("test.dart", r"""
18 import 'package:test/test.dart';
19
20 void main() {
21 tearDownAll(() => throw "oh no");
22
23 test("test", () {});
24 }
25 """).create();
26
27 var test = runTest(["test.dart"]);
28 test.stdout.expect(consumeThrough(contains("-1: (tearDownAll)")));
29 test.stdout.expect(consumeThrough(contains("-1: Some tests failed.")));
30 test.shouldExit(1);
31 });
32
33 test("doesn't run if no tests in the group are selected", () {
34 d.file("test.dart", r"""
35 import 'package:test/test.dart';
36
37 void main() {
38 group("with tearDownAll", () {
39 tearDownAll(() => throw "oh no");
40
41 test("test", () {});
42 });
43
44 group("without tearDownAll", () {
45 test("test", () {});
46 });
47 }
48 """).create();
49
50 var test = runTest(["test.dart", "--name", "without"]);
51 test.stdout.expect(never(contains("(tearDownAll)")));
52 test.shouldExit(0);
53 });
54
55 test("doesn't run if no tests in the group are selected", () {
56 d.file("test.dart", r"""
57 import 'package:test/test.dart';
58
59 void main() {
60 group("group", () {
61 tearDownAll(() => throw "oh no");
62
63 test("with", () {});
64 });
65
66 group("group", () {
67 test("without", () {});
68 });
69 }
70 """).create();
71
72 var test = runTest(["test.dart", "--name", "without"]);
73 test.stdout.expect(never(contains("(tearDownAll)")));
74 test.shouldExit(0);
75 });
76
77 test("doesn't run if no tests in the group match the platform", () {
78 d.file("test.dart", r"""
79 import 'package:test/test.dart';
80
81 void main() {
82 group("group", () {
83 tearDownAll(() => throw "oh no");
84
85 test("with", () {}, testOn: "browser");
86 });
87
88 group("group", () {
89 test("without", () {});
90 });
91 }
92 """).create();
93
94 var test = runTest(["test.dart"]);
95 test.stdout.expect(never(contains("(tearDownAll)")));
96 test.shouldExit(0);
97 });
98
99 test("doesn't run if the group doesn't match the platform", () {
100 d.file("test.dart", r"""
101 import 'package:test/test.dart';
102
103 void main() {
104 group("group", () {
105 tearDownAll(() => throw "oh no");
106
107 test("with", () {});
108 }, testOn: "browser");
109
110 group("group", () {
111 test("without", () {});
112 });
113 }
114 """).create();
115
116 var test = runTest(["test.dart"]);
117 test.stdout.expect(never(contains("(tearDownAll)")));
118 test.shouldExit(0);
119 });
120 }
OLDNEW
« no previous file with comments | « test/runner/signal_test.dart ('k') | test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698