OLD | NEW |
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 testOn: testOn, timeout: timeout, skip: skip); | 162 testOn: testOn, timeout: timeout, skip: skip); |
163 | 163 |
164 /// Registers a function to be run before tests. | 164 /// Registers a function to be run before tests. |
165 /// | 165 /// |
166 /// This function will be called before each test is run. [callback] may be | 166 /// This function will be called before each test is run. [callback] may be |
167 /// asynchronous; if so, it must return a [Future]. | 167 /// asynchronous; if so, it must return a [Future]. |
168 /// | 168 /// |
169 /// If this is called within a test group, it applies only to tests in that | 169 /// If this is called within a test group, it applies only to tests in that |
170 /// group. [callback] will be run after any set-up callbacks in parent groups or | 170 /// group. [callback] will be run after any set-up callbacks in parent groups or |
171 /// at the top level. | 171 /// at the top level. |
| 172 /// |
| 173 /// Each callback at the top level or in a given group will be run in the order |
| 174 /// they were declared. |
172 void setUp(callback()) => _declarer.setUp(callback); | 175 void setUp(callback()) => _declarer.setUp(callback); |
173 | 176 |
174 /// Registers a function to be run after tests. | 177 /// Registers a function to be run after tests. |
175 /// | 178 /// |
176 /// This function will be called after each test is run. [callback] may be | 179 /// This function will be called after each test is run. [callback] may be |
177 /// asynchronous; if so, it must return a [Future]. | 180 /// asynchronous; if so, it must return a [Future]. |
178 /// | 181 /// |
179 /// 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 |
180 /// 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 |
181 /// groups or at the top level. | 184 /// groups or at the top level. |
| 185 /// |
| 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. |
182 void tearDown(callback()) => _declarer.tearDown(callback); | 188 void tearDown(callback()) => _declarer.tearDown(callback); |
183 | 189 |
184 /// Registers an exception that was caught for the current test. | 190 /// Registers an exception that was caught for the current test. |
185 void registerException(error, [StackTrace stackTrace]) { | 191 void registerException(error, [StackTrace stackTrace]) { |
186 // This will usually forward directly to [Invoker.current.handleError], but | 192 // This will usually forward directly to [Invoker.current.handleError], but |
187 // going through the zone API allows other zones to consistently see errors. | 193 // going through the zone API allows other zones to consistently see errors. |
188 Zone.current.handleUncaughtError(error, stackTrace); | 194 Zone.current.handleUncaughtError(error, stackTrace); |
189 } | 195 } |
OLD | NEW |