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

Side by Side Diff: tools/coverage.dart

Issue 23054008: Remove the Path class from dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed first round of review comments Created 7 years, 4 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // This test forks a second vm process that runs a dart script as 5 // This test forks a second vm process that runs a dart script as
6 // a debug target, single stepping through the entire program, and 6 // a debug target, single stepping through the entire program, and
7 // recording each breakpoint. At the end, a coverage map of the source 7 // recording each breakpoint. At the end, a coverage map of the source
8 // is printed. 8 // is printed.
9 // 9 //
10 // Usage: dart coverage.dart [--wire] [--verbose] target_script.dart 10 // Usage: dart coverage.dart [--wire] [--verbose] target_script.dart
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 print(url); 97 print(url);
98 tokenCounts.forEach((tp, bpCount) { 98 tokenCounts.forEach((tp, bpCount) {
99 int lineNumber = tokenPosToLine[tp]; 99 int lineNumber = tokenPosToLine[tp];
100 var lineCount = lineCounts[lineNumber]; 100 var lineCount = lineCounts[lineNumber];
101 // Remember maximum breakpoint count of all tokens in this line. 101 // Remember maximum breakpoint count of all tokens in this line.
102 if (lineCount == null || lineCount < bpCount) { 102 if (lineCount == null || lineCount < bpCount) {
103 lineCounts[lineNumber] = bpCount; 103 lineCounts[lineNumber] = bpCount;
104 } 104 }
105 }); 105 });
106 106
107 String srcPath = new Path(Uri.parse(url).path).toNativePath(); 107 String srcPath = Uri.parse(url).toFilePath();
108 List lines = new File(srcPath).readAsLinesSync(); 108 List lines = new File(srcPath).readAsLinesSync();
109 for (int line = 1; line <= lines.length; line++) { 109 for (int line = 1; line <= lines.length; line++) {
110 String prefix = " "; 110 String prefix = " ";
111 if (lineCounts.containsKey(line)) { 111 if (lineCounts.containsKey(line)) {
112 prefix = lineCounts[line].toString(); 112 prefix = lineCounts[line].toString();
113 StringBuffer b = new StringBuffer(); 113 StringBuffer b = new StringBuffer();
114 for (int i = prefix.length; i < 6; i++) b.write(" "); 114 for (int i = prefix.length; i < 6; i++) b.write(" ");
115 b.write(prefix); 115 b.write(prefix);
116 prefix = b.toString(); 116 prefix = b.toString();
117 } 117 }
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 targetOpts.add(str); 539 targetOpts.add(str);
540 break; 540 break;
541 } 541 }
542 } 542 }
543 543
544 Process.start(options.executable, targetOpts).then((Process process) { 544 Process.start(options.executable, targetOpts).then((Process process) {
545 process.stdin.close(); 545 process.stdin.close();
546 debugger = new Debugger(process); 546 debugger = new Debugger(process);
547 }); 547 });
548 } 548 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698