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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 /// Registers a function to be run after tests. | 165 /// Registers a function to be run after tests. |
166 /// | 166 /// |
167 /// This function will be called after each test is run. [callback] may be | 167 /// This function will be called after each test is run. [callback] may be |
168 /// asynchronous; if so, it must return a [Future]. | 168 /// asynchronous; if so, it must return a [Future]. |
169 /// | 169 /// |
170 /// If this is called within a test group, it applies only to tests in that | 170 /// If this is called within a test group, it applies only to tests in that |
171 /// group. [callback] will be run before any tear-down callbacks in parent | 171 /// group. [callback] will be run before any tear-down callbacks in parent |
172 /// groups or at the top level. | 172 /// groups or at the top level. |
173 void tearDown(callback()) => _declarer.tearDown(callback); | 173 void tearDown(callback()) => _declarer.tearDown(callback); |
174 | 174 |
175 /// Handle an error that occurs outside of any test. | |
176 void handleExternalError(error, String message, [stackTrace]) { | |
177 // TODO(nweiz): handle this better. | |
178 registerException(error, stackTrace); | |
179 } | |
180 | |
181 /// Registers an exception that was caught for the current test. | 175 /// Registers an exception that was caught for the current test. |
182 void registerException(error, [StackTrace stackTrace]) => | 176 void registerException(error, [StackTrace stackTrace]) => |
183 Invoker.current.handleError(error, stackTrace); | 177 Invoker.current.handleError(error, stackTrace); |
OLD | NEW |