| 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.matcher; | 5 part of unittest.matcher; |
| 6 | 6 |
| 7 // To decouple the reporting of errors, and allow for extensibility of | 7 // To decouple the reporting of errors, and allow for extensibility of |
| 8 // matchers, we make use of some interfaces. | 8 // matchers, we make use of some interfaces. |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 /** This is used to add arbitrary text to the description. */ | 34 /** This is used to add arbitrary text to the description. */ |
| 35 Description add(String text); | 35 Description add(String text); |
| 36 | 36 |
| 37 /** This is used to add a meaningful description of a value. */ | 37 /** This is used to add a meaningful description of a value. */ |
| 38 Description addDescriptionOf(value); | 38 Description addDescriptionOf(value); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * This is used to add a description of an [Iterable] [list], | 41 * This is used to add a description of an [Iterable] [list], |
| 42 * with appropriate [start] and [end] markers and inter-element [separator]. | 42 * with appropriate [start] and [end] markers and inter-element [separator]. |
| 43 */ | 43 */ |
| 44 Description addAll(String start, String separator, String end, | 44 Description addAll(String start, String separator, String end, Iterable list); |
| 45 Iterable list); | |
| 46 } | 45 } |
| 47 | 46 |
| 48 /** | 47 /** |
| 49 * [expect] Matchers must implement/extend the Matcher class. | 48 * [expect] Matchers must implement/extend the Matcher class. |
| 50 * The base Matcher class has a generic implementation of [describeMismatch] | 49 * The base Matcher class has a generic implementation of [describeMismatch] |
| 51 * so this does not need to be provided unless a more clear description is | 50 * so this does not need to be provided unless a more clear description is |
| 52 * required. The other two methods ([matches] and [describe]) | 51 * required. The other two methods ([matches] and [describe]) |
| 53 * must always be provided as they are highly matcher-specific. | 52 * must always be provided as they are highly matcher-specific. |
| 54 */ | 53 */ |
| 55 abstract class Matcher { | 54 abstract class Matcher { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 * the [reason] (argument from [expect]), some additonal [matchState] | 94 * the [reason] (argument from [expect]), some additonal [matchState] |
| 96 * generated by the [matcher], and a verbose flag which controls in | 95 * generated by the [matcher], and a verbose flag which controls in |
| 97 * some cases how much [matchState] information is used. It will use | 96 * some cases how much [matchState] information is used. It will use |
| 98 * these to create a detailed error message (typically by calling | 97 * these to create a detailed error message (typically by calling |
| 99 * an [ErrorFormatter]) and then call [fail] with this message. | 98 * an [ErrorFormatter]) and then call [fail] with this message. |
| 100 */ | 99 */ |
| 101 void failMatch(actual, Matcher matcher, String reason, | 100 void failMatch(actual, Matcher matcher, String reason, |
| 102 Map matchState, bool verbose); | 101 Map matchState, bool verbose); |
| 103 } | 102 } |
| 104 | 103 |
| OLD | NEW |