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

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

Issue 12316072: Some fixes in unittest after io v2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: also include htmlconfig Created 7 years, 10 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 if the match argument is a string and 8 * Returns a matcher which matches if the match argument is a string and
9 * is equal to [value] when compared case-insensitively. 9 * is equal to [value] when compared case-insensitively.
10 */ 10 */
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 * and strip leading/trailing whitespace. 67 * and strip leading/trailing whitespace.
68 */ 68 */
69 String collapseWhitespace(_string) { 69 String collapseWhitespace(_string) {
70 bool isWhitespace(String ch) => (' \n\r\t'.indexOf(ch) >= 0); 70 bool isWhitespace(String ch) => (' \n\r\t'.indexOf(ch) >= 0);
71 StringBuffer result = new StringBuffer(); 71 StringBuffer result = new StringBuffer();
72 bool skipSpace = true; 72 bool skipSpace = true;
73 for (var i = 0; i < _string.length; i++) { 73 for (var i = 0; i < _string.length; i++) {
74 var character = _string[i]; 74 var character = _string[i];
75 if (isWhitespace(character)) { 75 if (isWhitespace(character)) {
76 if (!skipSpace) { 76 if (!skipSpace) {
77 result.add(' '); 77 result.write(' ');
78 skipSpace = true; 78 skipSpace = true;
79 } 79 }
80 } else { 80 } else {
81 result.add(character); 81 result.write(character);
82 skipSpace = false; 82 skipSpace = false;
83 } 83 }
84 } 84 }
85 return result.toString().trim(); 85 return result.toString().trim();
86 } 86 }
87 87
88 /** 88 /**
89 * Returns a matcher that matches if the match argument is a string and 89 * Returns a matcher that matches if the match argument is a string and
90 * starts with [prefixString]. 90 * starts with [prefixString].
91 */ 91 */
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (!(item is String)) { 194 if (!(item is String)) {
195 return mismatchDescription. 195 return mismatchDescription.
196 addDescriptionOf(item). 196 addDescriptionOf(item).
197 add(' not a string'); 197 add(' not a string');
198 } else { 198 } else {
199 return super.describeMismatch(item, mismatchDescription, 199 return super.describeMismatch(item, mismatchDescription,
200 matchState, verbose); 200 matchState, verbose);
201 } 201 }
202 } 202 }
203 } 203 }
OLDNEW
« pkg/unittest/lib/compact_vm_config.dart ('K') | « pkg/unittest/lib/html_config.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698