Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: pkg/unittest/lib/src/basematcher.dart

Issue 12181026: Fix dartdoc for BaseMatcher. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 matcher; 5 part of matcher;
6 6
7 /** 7 /**
8 * MatchState is a simple wrapper around an arbitrary object. 8 * MatchState is a simple wrapper around an arbitrary object.
9 * [Matcher] [matches] methods can use this to store useful 9 * [Matcher] [matches] methods can use this to store useful
10 * information upon match failures, and this information will 10 * information upon match failures, and this information will
11 * be passed to [describeMismatch]. Each [Matcher] is responsible 11 * be passed to [describeMismatch]. Each [Matcher] is responsible
12 * for its own use of this state, so the state created by [matches] 12 * for its own use of this state, so the state created by [matches]
13 * should be consistent with that expected by [describeMismatch] in 13 * should be consistent with that expected by [describeMismatch] in
14 * the same [Matcher] class, but can vary between classes. The inner 14 * the same [Matcher] class, but can vary between classes. The inner
15 * state, if set, will typically be a [Map] with a number of key-value 15 * state, if set, will typically be a [Map] with a number of key-value
16 * pairs containing relevant state information. 16 * pairs containing relevant state information.
17 */ 17 */
18 class MatchState { 18 class MatchState {
19 var state = null; 19 var state = null;
20 20
21 MatchState([this.state]); 21 MatchState([this.state]);
22 } 22 }
23 23
24 /** 24 /**
25 * BaseMatcher is the base class for all matchers. To implement a new 25 * BaseMatcher is the base class for all matchers. To implement a new
26 * matcher, either add a class that implements from IMatcher or 26 * matcher, either add a class that implements Matcher or a class that
27 * a class that inherits from Matcher. Inheriting from Matcher has 27 * extends BaseMatcher. Extending BaseMatcher has the benefit that a
28 * the benefit that a default implementation of describeMismatch will 28 * default implementation of describeMismatch will be provided.
29 * be provided.
30 */ 29 */
31 abstract class BaseMatcher implements Matcher { 30 abstract class BaseMatcher implements Matcher {
32 const BaseMatcher(); 31 const BaseMatcher();
33 32
34 /** 33 /**
35 * Tests the matcher against a given [item] 34 * Tests the matcher against a given [item]
36 * and return true if the match succeeds; false otherwise. 35 * and return true if the match succeeds; false otherwise.
37 * [matchState] may be used to return additional info for 36 * [matchState] may be used to return additional info for
38 * the use of [describeMismatch]. 37 * the use of [describeMismatch].
39 */ 38 */
40 bool matches(item, MatchState matchState); 39 bool matches(item, MatchState matchState);
41 40
42 /** 41 /**
43 * Creates a textual description of a matcher, 42 * Creates a textual description of a matcher,
44 * by appending to [mismatchDescription]. 43 * by appending to [mismatchDescription].
45 */ 44 */
46 Description describe(Description mismatchDescription); 45 Description describe(Description mismatchDescription);
47 46
48 /** 47 /**
49 * Generates a description of the matcher failed for a particular 48 * Generates a description of the matcher failed for a particular
50 * [item], by appending the description to [mismatchDescription]. 49 * [item], by appending the description to [mismatchDescription].
51 * It does not check whether the [item] fails the match, as it is 50 * It does not check whether the [item] fails the match, as it is
52 * only called after a failed match. There may be additional info 51 * only called after a failed match. There may be additional info
53 * about the mismatch in [matchState]. 52 * about the mismatch in [matchState].
54 */ 53 */
55 Description describeMismatch(item, Description mismatchDescription, 54 Description describeMismatch(item, Description mismatchDescription,
56 MatchState matchState, bool verbose) => 55 MatchState matchState, bool verbose) =>
57 mismatchDescription.add('was ').addDescriptionOf(item); 56 mismatchDescription.add('was ').addDescriptionOf(item);
58 } 57 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698