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

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

Issue 11275054: Modified unittest to use new argument syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
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 * Returns a matcher which matches if the match argument is a string and 6 * Returns a matcher which matches if the match argument is a string and
7 * is equal to [value] when compared case-insensitively. 7 * is equal to [value] when compared case-insensitively.
8 */ 8 */
9
10 part of unittest;
11
9 Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value); 12 Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value);
10 13
11 class _IsEqualIgnoringCase extends _StringMatcher { 14 class _IsEqualIgnoringCase extends _StringMatcher {
12 final String _value; 15 final String _value;
13 String _matchValue; 16 String _matchValue;
14 17
15 _IsEqualIgnoringCase(this._value) { 18 _IsEqualIgnoringCase(this._value) {
16 _matchValue = _value.toLowerCase(); 19 _matchValue = _value.toLowerCase();
17 } 20 }
18 21
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 description.add('a string ending with ').addDescriptionOf(_suffix); 123 description.add('a string ending with ').addDescriptionOf(_suffix);
121 } 124 }
122 125
123 /** 126 /**
124 * Returns a matcher that matches if the match argument is a string and 127 * Returns a matcher that matches if the match argument is a string and
125 * contains a given list of [substrings] in relative order. 128 * contains a given list of [substrings] in relative order.
126 * 129 *
127 * For example, `stringContainsInOrder(["a", "e", "i", "o", "u"])` will match 130 * For example, `stringContainsInOrder(["a", "e", "i", "o", "u"])` will match
128 * "abcdefghijklmnopqrstuvwxyz". 131 * "abcdefghijklmnopqrstuvwxyz".
129 */ 132 */
133
130 Matcher stringContainsInOrder(substrings) => 134 Matcher stringContainsInOrder(substrings) =>
131 new _StringContainsInOrder(substrings); 135 new _StringContainsInOrder(substrings);
132 136
133 class _StringContainsInOrder extends _StringMatcher { 137 class _StringContainsInOrder extends _StringMatcher {
134 138
135 final List<String> _substrings; 139 final List<String> _substrings;
136 140
137 const _StringContainsInOrder(this._substrings); 141 const _StringContainsInOrder(this._substrings);
138 142
139 bool matches(item, MatchState matchState) { 143 bool matches(item, MatchState matchState) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (!(item is String)) { 195 if (!(item is String)) {
192 return mismatchDescription. 196 return mismatchDescription.
193 addDescriptionOf(item). 197 addDescriptionOf(item).
194 add(' not a string'); 198 add(' not a string');
195 } else { 199 } else {
196 return super.describeMismatch(item, mismatchDescription, 200 return super.describeMismatch(item, mismatchDescription,
197 matchState, verbose); 201 matchState, verbose);
198 } 202 }
199 } 203 }
200 } 204 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698