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

Side by Side Diff: utils/pub/utils.dart

Issue 10699068: Add numerous features to the Pub test infrastructure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 /** 5 /**
6 * Generic utility functions. Stuff that should possibly be in core. 6 * Generic utility functions. Stuff that should possibly be in core.
7 */ 7 */
8 #library('utils'); 8 #library('utils');
9 9
10 /** Thrown by methods that parse text when the text isn't a valid. */ 10 /** Thrown by methods that parse text when the text isn't a valid. */
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 var buffer = new StringBuffer(); 93 var buffer = new StringBuffer();
94 var start = 0; 94 var start = 0;
95 for (var match in matcher.allMatches(source)) { 95 for (var match in matcher.allMatches(source)) {
96 buffer.add(source.substring(start, match.start())); 96 buffer.add(source.substring(start, match.start()));
97 start = match.end(); 97 start = match.end();
98 buffer.add(fn(match)); 98 buffer.add(fn(match));
99 } 99 }
100 buffer.add(source.substring(start)); 100 buffer.add(source.substring(start));
101 return buffer.toString(); 101 return buffer.toString();
102 } 102 }
103
104 /**
105 * Returns whether or not [str] ends with [matcher].
106 */
107 bool endsWithPattern(String str, Pattern matcher) {
108 for (var match in matcher.allMatches(str)) {
109 if (match.end() == str.length) return true;
110 }
111 return false;
112 }
OLDNEW
« no previous file with comments | « utils/pub/io.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | utils/tests/pub/test_pub.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698