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

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

Issue 10579008: Added test setup/teardown. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « lib/unittest/map_matchers.dart ('k') | lib/unittest/test_case.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 * 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 Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value); 9 Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value);
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 172
173 bool matches(String item) => _regexp.hasMatch(item); 173 bool matches(String item) => _regexp.hasMatch(item);
174 174
175 Description describe(Description description) => 175 Description describe(Description description) =>
176 description.add("match '${_regexp.pattern}'"); 176 description.add("match '${_regexp.pattern}'");
177 } 177 }
178 178
179 // String matchers match against a string. We add this intermediate 179 // String matchers match against a string. We add this intermediate
180 // class to give better mismatch error messages than the base Matcher class. 180 // class to give better mismatch error messages than the base Matcher class.
181 /*abstract*/ class _StringMatcher extends BaseMatcher { 181 /* abstract */ class _StringMatcher extends BaseMatcher {
182 const _StringMatcher(); 182 const _StringMatcher();
183 Description describeMismatch(item, Description mismatchDescription) { 183 Description describeMismatch(item, Description mismatchDescription) {
184 if (!(item is String)) { 184 if (!(item is String)) {
185 return mismatchDescription. 185 return mismatchDescription.
186 addDescriptionOf(item). 186 addDescriptionOf(item).
187 add(' not a string'); 187 add(' not a string');
188 } else { 188 } else {
189 return super.describeMismatch(item, mismatchDescription); 189 return super.describeMismatch(item, mismatchDescription);
190 } 190 }
191 } 191 }
192 } 192 }
OLDNEW
« no previous file with comments | « lib/unittest/map_matchers.dart ('k') | lib/unittest/test_case.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698