| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 part of matcher; | |
| 6 | |
| 7 /** | |
| 8 * BaseMatcher is the base class for all matchers. To implement a new | |
| 9 * matcher, either add a class that implements Matcher or a class that | |
| 10 * extends BaseMatcher. Extending BaseMatcher has the benefit that a | |
| 11 * default implementation of describeMismatch will be provided. | |
| 12 */ | |
| 13 abstract class BaseMatcher implements Matcher { | |
| 14 const BaseMatcher(); | |
| 15 | |
| 16 /** | |
| 17 * Tests the matcher against a given [item] | |
| 18 * and return true if the match succeeds; false otherwise. | |
| 19 * [matchState] may be used to return additional info for | |
| 20 * the use of [describeMismatch]. | |
| 21 */ | |
| 22 bool matches(item, Map matchState); | |
| 23 | |
| 24 /** | |
| 25 * Creates a textual description of a matcher, | |
| 26 * by appending to [mismatchDescription]. | |
| 27 */ | |
| 28 Description describe(Description mismatchDescription); | |
| 29 | |
| 30 /** | |
| 31 * Generates a description of the matcher failed for a particular | |
| 32 * [item], by appending the description to [mismatchDescription]. | |
| 33 * It does not check whether the [item] fails the match, as it is | |
| 34 * only called after a failed match. There may be additional info | |
| 35 * about the mismatch in [matchState]. | |
| 36 * The base matcher does not add anything as the actual value is | |
| 37 * typically sufficient, but matchers that can add valuable info | |
| 38 * should override this. | |
| 39 */ | |
| 40 Description describeMismatch(item, Description mismatchDescription, | |
| 41 Map matchState, bool verbose) => | |
| 42 mismatchDescription; | |
| 43 } | |
| OLD | NEW |