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

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

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variable. Created 8 years, 1 month 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/dartdoc/lib/src/mirrors/dart2js_mirror.dart ('k') | pkg/unittest/mock.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 const Matcher isEmpty = const _Empty(); 9 const Matcher isEmpty = const _Empty();
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 String _compareIterables(expected, actual, matcher, depth) { 96 String _compareIterables(expected, actual, matcher, depth) {
97 if (actual is !Iterable) { 97 if (actual is !Iterable) {
98 return 'is not Iterable'; 98 return 'is not Iterable';
99 } 99 }
100 var expectedIterator = expected.iterator(); 100 var expectedIterator = expected.iterator();
101 var actualIterator = actual.iterator(); 101 var actualIterator = actual.iterator();
102 var position = 0; 102 var position = 0;
103 String reason = null; 103 String reason = null;
104 while (reason == null) { 104 while (reason == null) {
105 if (expectedIterator.hasNext()) { 105 if (expectedIterator.hasNext) {
106 if (actualIterator.hasNext()) { 106 if (actualIterator.hasNext) {
107 Description r = matcher(expectedIterator.next(), 107 Description r = matcher(expectedIterator.next(),
108 actualIterator.next(), 108 actualIterator.next(),
109 'mismatch at position ${position}', 109 'mismatch at position ${position}',
110 depth); 110 depth);
111 if (r != null) reason = r.toString(); 111 if (r != null) reason = r.toString();
112 ++position; 112 ++position;
113 } else { 113 } else {
114 reason = 'shorter than expected'; 114 reason = 'shorter than expected';
115 } 115 }
116 } else if (actualIterator.hasNext()) { 116 } else if (actualIterator.hasNext) {
117 reason = 'longer than expected'; 117 reason = 'longer than expected';
118 } else { 118 } else {
119 return null; 119 return null;
120 } 120 }
121 } 121 }
122 return reason; 122 return reason;
123 } 123 }
124 124
125 Description _recursiveMatch(expected, actual, String location, int depth) { 125 Description _recursiveMatch(expected, actual, String location, int depth) {
126 Description reason = null; 126 Description reason = null;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 final _matcher; 618 final _matcher;
619 final String _description; 619 final String _description;
620 620
621 const _Predicate(this._matcher, this._description); 621 const _Predicate(this._matcher, this._description);
622 622
623 bool matches(item, MatchState matchState) => _matcher(item); 623 bool matches(item, MatchState matchState) => _matcher(item);
624 624
625 Description describe(Description description) => 625 Description describe(Description description) =>
626 description.add(_description); 626 description.add(_description);
627 } 627 }
OLDNEW
« no previous file with comments | « pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart ('k') | pkg/unittest/mock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698