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

Side by Side Diff: lib/unittest/core_matchers.dart

Issue 10694146: Added ability to disable logging in mocks, to avoid the memory overhead if you don't need behavior … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « no previous file | lib/unittest/expect.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 5
6 /** 6 /**
7 * Returns a matcher that matches empty strings, maps or collections. 7 * Returns a matcher that matches empty strings, maps or collections.
8 */ 8 */
9 final Matcher isEmpty = const _Empty(); 9 final Matcher isEmpty = const _Empty();
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // expect() will show it for us. 159 // expect() will show it for us.
160 reason = new StringDescription(); 160 reason = new StringDescription();
161 if (depth > 1) { 161 if (depth > 1) {
162 reason.add('expected ').addDescriptionOf(expected).add(' but was '). 162 reason.add('expected ').addDescriptionOf(expected).add(' but was ').
163 addDescriptionOf(actual); 163 addDescriptionOf(actual);
164 } else { 164 } else {
165 reason.add('was ').addDescriptionOf(actual); 165 reason.add('was ').addDescriptionOf(actual);
166 } 166 }
167 } 167 }
168 } 168 }
169 if (reason != null) { 169 if (reason != null && location.length > 0) {
170 reason.add(' ').add(location); 170 reason.add(' ').add(location);
171 } 171 }
172 return reason; 172 return reason;
173 } 173 }
174 174
175 String _match(expected, actual) { 175 String _match(expected, actual) {
176 Description reason = _recursiveMatch(expected, actual, '', 0); 176 Description reason = _recursiveMatch(expected, actual, '', 0);
177 return reason == null ? null : reason.toString(); 177 return reason == null ? null : reason.toString();
178 } 178 }
179 179
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 final _matcher; 587 final _matcher;
588 final String _description; 588 final String _description;
589 589
590 const _Predicate(this._matcher, this._description); 590 const _Predicate(this._matcher, this._description);
591 591
592 bool matches(item) => _matcher(item); 592 bool matches(item) => _matcher(item);
593 593
594 Description describe(Description description) => 594 Description describe(Description description) =>
595 description.add(_description); 595 description.add(_description);
596 } 596 }
OLDNEW
« no previous file with comments | « no previous file | lib/unittest/expect.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698