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

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

Issue 14600029: Add pretty-printing to unittest and more thoroughly print values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 7 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
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 * Returns a matcher which matches [Iterable]s in which all elements 8 * Returns a matcher which matches [Iterable]s in which all elements
9 * match the given [matcher]. 9 * match the given [matcher].
10 */ 10 */
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 Description describe(Description description) => 37 Description describe(Description description) =>
38 description.add('every element ').addDescriptionOf(_matcher); 38 description.add('every element ').addDescriptionOf(_matcher);
39 39
40 Description describeMismatch(item, Description mismatchDescription, 40 Description describeMismatch(item, Description mismatchDescription,
41 MatchState matchState, bool verbose) { 41 MatchState matchState, bool verbose) {
42 if (matchState.state != null) { 42 if (matchState.state != null) {
43 var index = matchState.state['index']; 43 var index = matchState.state['index'];
44 var element = matchState.state['element']; 44 var element = matchState.state['element'];
45 mismatchDescription.add('position $index ');
45 return _matcher.describeMismatch(element, mismatchDescription, 46 return _matcher.describeMismatch(element, mismatchDescription,
46 matchState.state['state'], verbose).add(' at position $index'); 47 matchState.state['state'], verbose);
47 } 48 }
48 return super.describeMismatch(item, mismatchDescription, 49 return super.describeMismatch(item, mismatchDescription,
49 matchState, verbose); 50 matchState, verbose);
50 } 51 }
51 } 52 }
52 53
53 /** 54 /**
54 * Returns a matcher which matches [Iterable]s in which at least one 55 * Returns a matcher which matches [Iterable]s in which at least one
55 * element matches the given [matcher]. 56 * element matches the given [matcher].
56 */ 57 */
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } else { 237 } else {
237 return mismatchDescription. 238 return mismatchDescription.
238 addDescriptionOf(matchState.state["actual"]). 239 addDescriptionOf(matchState.state["actual"]).
239 add(' not $_description '). 240 add(' not $_description ').
240 addDescriptionOf(matchState.state["expected"]). 241 addDescriptionOf(matchState.state["expected"]).
241 add(' at position ${matchState.state["index"]}'); 242 add(' at position ${matchState.state["index"]}');
242 } 243 }
243 } 244 }
244 } 245 }
245 246
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698