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

Unified Diff: tools/testing/legpad/legpad.dart

Issue 9958048: display line count in legpad (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/testing/legpad/legpad.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/legpad/legpad.dart
diff --git a/tools/testing/legpad/legpad.dart b/tools/testing/legpad/legpad.dart
index b79b80ebfe96b71e3ce3e291eb42dd46e32b8a7b..474dc01e467cab65858d40729e172813880801c0 100644
--- a/tools/testing/legpad/legpad.dart
+++ b/tools/testing/legpad/legpad.dart
@@ -80,10 +80,21 @@ class Legpad {
setText("output", output);
setText("warnings", warnings);
- String timing = "generated ${output.length} characters in " +
+ int lineCount = lineCount(output);
+ String timing = "generated $lineCount lines " +
+ "(${output.length} characters) in " +
"${((elapsedMillis) / 1000).toStringAsPrecision(3)} seconds";
setText("timing", timing);
}
+
+ static int lineCount(String s) {
ahe 2012/04/10 21:36:54 I feel this should be easier, but I don't know how
+ Iterable<Match> matches = "\n".allMatches(s);
+ int n = 0;
+ for (Match m in matches) {
+ n++;
+ }
+ return n;
+ }
void runLeg() {
uri_lib.Uri mainUri = new uri_lib.Uri.fromString(getText(MAIN_ID));
« no previous file with comments | « no previous file | tools/testing/legpad/legpad.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698