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

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

Issue 18442002: Add missing newline after Actual value in fail message. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | « pkg/unittest/lib/src/future_matchers.dart ('k') | pkg/unittest/lib/src/iterable_matchers.dart » ('j') | 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 // 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 28 matching lines...) Expand all
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,
45 Iterable list); 45 Iterable list);
46 } 46 }
47 47
48 /** 48 /**
49 * [expect] Matchers must implement the Matcher class. 49 * [expect] Matchers must implement/extend the Matcher class.
50 * The base Matcher class that implements this interface has 50 * The base Matcher class has a generic implementation of [describeMismatch]
51 * a generic implementation of [describeMismatch] so this does 51 * so this does not need to be provided unless a more clear description is
52 * not need to be provided unless a more clear description is
53 * required. The other two methods ([matches] and [describe]) 52 * required. The other two methods ([matches] and [describe])
54 * must always be provided as they are highly matcher-specific. 53 * must always be provided as they are highly matcher-specific.
55 */ 54 */
56 abstract class Matcher { 55 abstract class Matcher {
56 const Matcher();
57
57 /** 58 /**
58 * This does the matching of the actual vs expected values. 59 * This does the matching of the actual vs expected values.
59 * [item] is the actual value. [matchState] can be supplied 60 * [item] is the actual value. [matchState] can be supplied
60 * and may be used to add details about the mismatch that are too 61 * and may be used to add details about the mismatch that are too
61 * costly to determine in [describeMismatch]. 62 * costly to determine in [describeMismatch].
62 */ 63 */
63 bool matches(item, Map matchState); 64 bool matches(item, Map matchState);
64 65
65 /** This builds a textual description of the matcher. */ 66 /** This builds a textual description of the matcher. */
66 Description describe(Description description); 67 Description describe(Description description);
67 68
68 /** 69 /**
69 * This builds a textual description of a specific mismatch. [item] 70 * This builds a textual description of a specific mismatch. [item]
70 * is the value that was tested by [matches]; [matchState] is 71 * is the value that was tested by [matches]; [matchState] is
71 * the [Map] that was passed to and supplemented by [matches] 72 * the [Map] that was passed to and supplemented by [matches]
72 * with additional information about the mismact, and [mismatchDescription] 73 * with additional information about the mismact, and [mismatchDescription]
73 * is the [Description] that is being built to decribe the mismatch. 74 * is the [Description] that is being built to decribe the mismatch.
74 * A few matchers make use of the [verbose] flag to provide detailed 75 * A few matchers make use of the [verbose] flag to provide detailed
75 * information that is not typically included but can be of help in 76 * information that is not typically included but can be of help in
76 * diagnosing failures, such as stack traces. 77 * diagnosing failures, such as stack traces.
77 */ 78 */
78 Description describeMismatch(item, Description mismatchDescription, 79 Description describeMismatch(item, Description mismatchDescription,
79 Map matchState, bool verbose); 80 Map matchState, bool verbose) => mismatchDescription;
80 } 81 }
81 82
82 /** 83 /**
83 * Failed matches are reported using a default IFailureHandler. 84 * Failed matches are reported using a default IFailureHandler.
84 * The default implementation simply throws [TestFailure]s; 85 * The default implementation simply throws [TestFailure]s;
85 * this can be replaced by some other implementation of 86 * this can be replaced by some other implementation of
86 * IFailureHandler by calling configureExpectHandler. 87 * IFailureHandler by calling configureExpectHandler.
87 */ 88 */
88 abstract class FailureHandler { 89 abstract class FailureHandler {
89 /** This handles failures given a textual decription */ 90 /** This handles failures given a textual decription */
90 void fail(String reason); 91 void fail(String reason);
91 92
92 /** 93 /**
93 * This handles failures given the actual [value], the [matcher] 94 * This handles failures given the actual [value], the [matcher]
94 * the [reason] (argument from [expect]), some additonal [matchState] 95 * the [reason] (argument from [expect]), some additonal [matchState]
95 * generated by the [matcher], and a verbose flag which controls in 96 * generated by the [matcher], and a verbose flag which controls in
96 * some cases how much [matchState] information is used. It will use 97 * some cases how much [matchState] information is used. It will use
97 * these to create a detailed error message (typically by calling 98 * these to create a detailed error message (typically by calling
98 * an [ErrorFormatter]) and then call [fail] with this message. 99 * an [ErrorFormatter]) and then call [fail] with this message.
99 */ 100 */
100 void failMatch(actual, Matcher matcher, String reason, 101 void failMatch(actual, Matcher matcher, String reason,
101 Map matchState, bool verbose); 102 Map matchState, bool verbose);
102 } 103 }
103 104
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/future_matchers.dart ('k') | pkg/unittest/lib/src/iterable_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698