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

Side by Side Diff: lib/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 | « lib/src/runner/vm/isolate_listener.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test; 5 library test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 /// asynchronous; if so, it must return a [Future]. 180 /// asynchronous; if so, it must return a [Future].
181 /// 181 ///
182 /// If this is called within a test group, it applies only to tests in that 182 /// If this is called within a test group, it applies only to tests in that
183 /// group. [callback] will be run before any tear-down callbacks in parent 183 /// group. [callback] will be run before any tear-down callbacks in parent
184 /// groups or at the top level. 184 /// groups or at the top level.
185 /// 185 ///
186 /// Each callback at the top level or in a given group will be run in the 186 /// Each callback at the top level or in a given group will be run in the
187 /// reverse of the order they were declared. 187 /// reverse of the order they were declared.
188 void tearDown(callback()) => _declarer.tearDown(callback); 188 void tearDown(callback()) => _declarer.tearDown(callback);
189 189
190 /// Registers a function to be run once before all tests.
191 ///
192 /// [callback] may be asynchronous; if so, it must return a [Future].
193 ///
194 /// If this is called within a test group, [callback] will run before all tests
195 /// in that group. It will be run after any [setUpAll] callbacks in parent
196 /// groups or at the top level. It won't be run if none of the tests in the
197 /// group are run.
198 ///
199 /// **Note**: This function makes it very easy to accidentally introduce hidden
200 /// dependencies between tests that should be isolated. In general, you should
201 /// prefer [setUp], and only use [setUpAll] if the callback is prohibitively
202 /// slow.
203 void setUpAll(callback()) => _declarer.setUpAll(callback);
204
205 /// Registers a function to be run once after all tests.
206 ///
207 /// If this is called within a test group, [callback] will run after all tests
208 /// in that group. It will be run before any [tearDownAll] callbacks in parent
209 /// groups or at the top level. It won't be run if none of the tests in the
210 /// group are run.
211 ///
212 /// **Note**: This function makes it very easy to accidentally introduce hidden
213 /// dependencies between tests that should be isolated. In general, you should
214 /// prefer [tearDown], and only use [tearDOwnAll] if the callback is
215 /// prohibitively slow.
216 void tearDownAll(callback()) => _declarer.tearDownAll(callback);
217
190 /// Registers an exception that was caught for the current test. 218 /// Registers an exception that was caught for the current test.
191 void registerException(error, [StackTrace stackTrace]) { 219 void registerException(error, [StackTrace stackTrace]) {
192 // This will usually forward directly to [Invoker.current.handleError], but 220 // This will usually forward directly to [Invoker.current.handleError], but
193 // going through the zone API allows other zones to consistently see errors. 221 // going through the zone API allows other zones to consistently see errors.
194 Zone.current.handleUncaughtError(error, stackTrace); 222 Zone.current.handleUncaughtError(error, stackTrace);
195 } 223 }
OLDNEW
« no previous file with comments | « lib/src/runner/vm/isolate_listener.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698