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 // To decouple the reporting of errors, and allow for extensibility of | 5 // To decouple the reporting of errors, and allow for extensibility of |
6 // matchers, we make use of some interfaces. | 6 // matchers, we make use of some interfaces. |
7 | 7 |
8 /** | 8 /** |
9 * The ErrorFormatter type is used for functions that | 9 * The ErrorFormatter type is used for functions that |
10 * can be used to build up error reports upon [expect] failures. | 10 * can be used to build up error reports upon [expect] failures. |
11 * There is one built-in implementation ([defaultErrorFormatter]) | 11 * There is one built-in implementation ([defaultErrorFormatter]) |
12 * which is used by the default failure handler. If the failure handler | 12 * which is used by the default failure handler. If the failure handler |
13 * is replaced it may be desirable to replace the [stringDescription] | 13 * is replaced it may be desirable to replace the [stringDescription] |
14 * error formatter with another. | 14 * error formatter with another. |
15 */ | 15 */ |
16 | 16 |
17 part of unittest; | 17 part of matcher; |
18 | 18 |
19 typedef String ErrorFormatter(actual, Matcher matcher, String reason, | 19 typedef String ErrorFormatter(actual, Matcher matcher, String reason, |
20 MatchState matchState, bool verbose); | 20 MatchState matchState, bool verbose); |
21 | 21 |
22 /** | 22 /** |
23 * Matchers build up their error messages by appending to | 23 * Matchers build up their error messages by appending to |
24 * Description objects. This interface is implemented by | 24 * Description objects. This interface is implemented by |
25 * StringDescription. This interface is unlikely to need | 25 * StringDescription. This interface is unlikely to need |
26 * other implementations, but could be useful to replace in | 26 * other implementations, but could be useful to replace in |
27 * some cases - e.g. language conversion. | 27 * some cases - e.g. language conversion. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 * the [reason] (argument from [expect]), some additonal [matchState] | 93 * the [reason] (argument from [expect]), some additonal [matchState] |
94 * generated by the [matcher], and a verbose flag which controls in | 94 * generated by the [matcher], and a verbose flag which controls in |
95 * some cases how much [matchState] information is used. It will use | 95 * some cases how much [matchState] information is used. It will use |
96 * these to create a detailed error message (typically by calling | 96 * these to create a detailed error message (typically by calling |
97 * an [ErrorFormatter]) and then call [fail] with this message. | 97 * an [ErrorFormatter]) and then call [fail] with this message. |
98 */ | 98 */ |
99 void failMatch(actual, Matcher matcher, String reason, | 99 void failMatch(actual, Matcher matcher, String reason, |
100 MatchState matchState, bool verbose); | 100 MatchState matchState, bool verbose); |
101 } | 101 } |
102 | 102 |
OLD | NEW |