OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of unittest; | 5 part of matcher; |
6 | |
7 /** | |
8 * Some matchers, like those for Futures and exception testing, | |
9 * can fail in asynchronous sections, and throw exceptions. | |
10 * A user of this library will typically want to catch and handle | |
11 * such exceptions. The [asyncGuard] property is a function that | |
Siggi Cherem (dart-lang)
2012/10/31 20:54:02
asyncGuard => _wrapAsync?
gram
2012/11/01 21:23:19
Done.
| |
12 * can wrap callbacks used by these Matchers so that they can be | |
13 * used safely. For example, the unittest library will set this | |
14 * to be expectAsync1. By default this is an identity function. | |
15 */ | |
Siggi Cherem (dart-lang)
2012/10/31 20:54:02
nits:
- move this comment to the publicly visible
gram
2012/11/01 21:23:19
Done.
| |
16 | |
17 Function _wrapAsync = (f) => f; | |
18 | |
19 set wrapAsync(Function f) => _wrapAsync = f; | |
Siggi Cherem (dart-lang)
2012/10/31 20:54:02
seems silly to have a private property that can be
gram
2012/11/01 21:23:19
Done.
| |
6 | 20 |
7 /** | 21 /** |
8 * This is the main assertion function. It asserts that [actual] | 22 * This is the main assertion function. It asserts that [actual] |
9 * matches the [matcher]. [reason] is optional and is typically not | 23 * matches the [matcher]. [reason] is optional and is typically not |
10 * supplied, as a reason is generated from the matcher; if [reason] | 24 * supplied, as a reason is generated from the matcher; if [reason] |
11 * is included it is appended to the reason generated by the matcher. | 25 * is included it is appended to the reason generated by the matcher. |
12 * | 26 * |
13 * [matcher] can be a value in which case it will be wrapped in an | 27 * [matcher] can be a value in which case it will be wrapped in an |
14 * [equals] matcher. | 28 * [equals] matcher. |
15 * | 29 * |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 * formatter is returned; this allows custom expect handlers to easily | 149 * formatter is returned; this allows custom expect handlers to easily |
136 * get a reference to the default formatter. | 150 * get a reference to the default formatter. |
137 */ | 151 */ |
138 ErrorFormatter configureExpectFormatter([ErrorFormatter formatter = null]) { | 152 ErrorFormatter configureExpectFormatter([ErrorFormatter formatter = null]) { |
139 if (formatter == null) { | 153 if (formatter == null) { |
140 formatter = _defaultErrorFormatter; | 154 formatter = _defaultErrorFormatter; |
141 } | 155 } |
142 return _assertErrorFormatter = formatter; | 156 return _assertErrorFormatter = formatter; |
143 } | 157 } |
144 | 158 |
OLD | NEW |