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

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

Issue 12417004: Update the test runner to use the new dart:io API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r19938 Created 7 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 | « tools/testing/dart/multitest.dart ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/status_file_parser.dart
diff --git a/tools/testing/dart/status_file_parser.dart b/tools/testing/dart/status_file_parser.dart
index d314581fb6e18cef96dca3d1c213538304ad9941..dc3d5fe4e475bfa30383061e0bbaa78807a89bb6 100644
--- a/tools/testing/dart/status_file_parser.dart
+++ b/tools/testing/dart/status_file_parser.dart
@@ -4,6 +4,7 @@
library status_file_parser;
+import "dart:async";
import "dart:io";
import "status_expression.dart";
@@ -65,49 +66,45 @@ void ReadConfigurationInto(path, sections, onDone) {
if (!file.existsSync()) {
throw new Exception('Cannot find test status file $path');
}
- InputStream file_stream = file.openInputStream();
- StringInputStream lines = new StringInputStream(file_stream);
+ Stream<String> lines =
+ file.openRead()
+ .transform(new StringDecoder())
+ .transform(new LineTransformer());
Section current = new Section.always();
sections.add(current);
- lines.onLine = () {
- String line;
- while ((line = lines.readLine()) != null) {
- Match match = StripComment.firstMatch(line);
- line = (match == null) ? "" : match[0];
- line = line.trim();
- if (line.isEmpty) continue;
-
- match = HeaderPattern.firstMatch(line);
- if (match != null) {
- String condition_string = match[1].trim();
- List<String> tokens = new Tokenizer(condition_string).tokenize();
- ExpressionParser parser = new ExpressionParser(new Scanner(tokens));
- current = new Section(parser.parseBooleanExpression());
- sections.add(current);
- continue;
- }
-
- match = RulePattern.firstMatch(line);
- if (match != null) {
- String name = match[1].trim();
- // TODO(whesse): Handle test names ending in a wildcard (*).
- String expression_string = match[2].trim();
- List<String> tokens = new Tokenizer(expression_string).tokenize();
- SetExpression expression =
- new ExpressionParser(new Scanner(tokens)).parseSetExpression();
- current.testRules.add(new TestRule(name, expression));
- continue;
- }
+ lines.listen((String line) {
+ Match match = StripComment.firstMatch(line);
+ line = (match == null) ? "" : match[0];
+ line = line.trim();
+ if (line.isEmpty) return;
+
+ match = HeaderPattern.firstMatch(line);
+ if (match != null) {
+ String condition_string = match[1].trim();
+ List<String> tokens = new Tokenizer(condition_string).tokenize();
+ ExpressionParser parser = new ExpressionParser(new Scanner(tokens));
+ current = new Section(parser.parseBooleanExpression());
+ sections.add(current);
+ return;
+ }
- print("unmatched line: $line");
+ match = RulePattern.firstMatch(line);
+ if (match != null) {
+ String name = match[1].trim();
+ // TODO(whesse): Handle test names ending in a wildcard (*).
+ String expression_string = match[2].trim();
+ List<String> tokens = new Tokenizer(expression_string).tokenize();
+ SetExpression expression =
+ new ExpressionParser(new Scanner(tokens)).parseSetExpression();
+ current.testRules.add(new TestRule(name, expression));
+ return;
}
- };
- lines.onClosed = () {
- onDone();
- };
+ print("unmatched line: $line");
+ },
+ onDone: onDone);
}
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698