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

Side by Side Diff: pkg/unittest/lib/src/expect.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/core_matchers.dart ('k') | pkg/unittest/lib/src/future_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 /** The objects thrown by the default failure handler. */ 7 /** The objects thrown by the default failure handler. */
8 class TestFailure { 8 class TestFailure {
9 String _message; 9 String _message;
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 // The error message formatter for failed asserts. 144 // The error message formatter for failed asserts.
145 ErrorFormatter _assertErrorFormatter = null; 145 ErrorFormatter _assertErrorFormatter = null;
146 146
147 // The default error formatter implementation. 147 // The default error formatter implementation.
148 String _defaultErrorFormatter(actual, Matcher matcher, String reason, 148 String _defaultErrorFormatter(actual, Matcher matcher, String reason,
149 Map matchState, bool verbose) { 149 Map matchState, bool verbose) {
150 var description = new StringDescription(); 150 var description = new StringDescription();
151 description.add('Expected: ').addDescriptionOf(matcher).add('\n'); 151 description.add('Expected: ').addDescriptionOf(matcher).add('\n');
152 description.add(' Actual: ').addDescriptionOf(actual); 152 description.add(' Actual: ').addDescriptionOf(actual).add('\n');
153 153
154 var mismatchDescription = new StringDescription(); 154 var mismatchDescription = new StringDescription();
155 matcher.describeMismatch(actual, mismatchDescription, matchState, verbose); 155 matcher.describeMismatch(actual, mismatchDescription, matchState, verbose);
156 156
157 if (mismatchDescription.length > 0) { 157 if (mismatchDescription.length > 0) {
158 description.add(' Which: ${mismatchDescription}\n'); 158 description.add(' Which: ${mismatchDescription}\n');
159 } 159 }
160 if (reason != null) { 160 if (reason != null) {
161 description.add(reason).add('\n'); 161 description.add(reason).add('\n');
162 } 162 }
163 return description.toString(); 163 return description.toString();
164 } 164 }
165 165
166 /** 166 /**
167 * Changes or resets to default the failure message formatter for expect(). 167 * Changes or resets to default the failure message formatter for expect().
168 * [formatter] is a reference to the new formatter; if this is omitted or 168 * [formatter] is a reference to the new formatter; if this is omitted or
169 * null then the failure formatter is reset to the default. The new 169 * null then the failure formatter is reset to the default. The new
170 * formatter is returned; this allows custom expect handlers to easily 170 * formatter is returned; this allows custom expect handlers to easily
171 * get a reference to the default formatter. 171 * get a reference to the default formatter.
172 */ 172 */
173 ErrorFormatter configureExpectFormatter([ErrorFormatter formatter = null]) { 173 ErrorFormatter configureExpectFormatter([ErrorFormatter formatter = null]) {
174 if (formatter == null) { 174 if (formatter == null) {
175 formatter = _defaultErrorFormatter; 175 formatter = _defaultErrorFormatter;
176 } 176 }
177 return _assertErrorFormatter = formatter; 177 return _assertErrorFormatter = formatter;
178 } 178 }
179 179
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/core_matchers.dart ('k') | pkg/unittest/lib/src/future_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698