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

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

Issue 143453012: Added tools/status_clean.dart script (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: dart/tools/testing/dart/status_file_parser.dart
diff --git a/dart/tools/testing/dart/status_file_parser.dart b/dart/tools/testing/dart/status_file_parser.dart
index 7d12efbdc114ca825ef9ca1f606aa27e384f6b1f..13cc063c70d68fd58775deb4fd73964df80a3c08 100644
--- a/dart/tools/testing/dart/status_file_parser.dart
+++ b/dart/tools/testing/dart/status_file_parser.dart
@@ -7,7 +7,9 @@ library status_file_parser;
import "dart:async";
import "dart:convert" show LineSplitter, UTF8;
import "dart:io";
+
import "status_expression.dart";
+import "utils.dart" show Path;
class Expectation {
// Possible outcomes of running a test.
@@ -110,14 +112,25 @@ final RegExp RulePattern = new RegExp(r"\s*([^: ]*)\s*:(.*)");
final RegExp IssueNumberPattern =
new RegExp("Issue ([0-9]+)|dartbug.com/([0-9]+)", caseSensitive: false);
+class StatusFile {
+ final Path location;
+
+ StatusFile(this.location);
+}
+
// TODO(whesse): Implement configuration_info library that contains data
// structures for test configuration, including Section.
class Section {
- BooleanExpression condition;
- List<TestRule> testRules;
+ final StatusFile statusFile;
- Section.always() : condition = null, testRules = new List<TestRule>();
- Section(this.condition) : testRules = new List<TestRule>();
+ final BooleanExpression condition;
+ final List<TestRule> testRules;
+ final int lineNr;
ricow1 2014/02/11 14:33:52 lineNr -> lineNumber
kustermann 2014/02/14 11:52:07 Done.
+
+ Section.always(this.statusFile, this.lineNr)
+ : condition = null, testRules = new List<TestRule>();
+ Section(this.statusFile, this.condition, this.lineNr)
+ : testRules = new List<TestRule>();
bool isEnabled(environment) =>
condition == null || condition.evaluate(environment);
@@ -153,24 +166,28 @@ Future ReadTestExpectationsInto(TestExpectations expectations,
completer.complete();
}
- ReadConfigurationInto(statusFilePath, sections, sectionsRead);
+ ReadConfigurationInto(new Path(statusFilePath), sections, sectionsRead);
Bill Hesse 2014/02/13 17:05:08 As we've said before, it would be nice to replace
kustermann 2014/02/14 11:52:07 There are *many* places we need to change, yes.
return completer.future;
}
-void ReadConfigurationInto(path, sections, onDone) {
- File file = new File(path);
+void ReadConfigurationInto(Path path, sections, onDone) {
+ StatusFile statusFile = new StatusFile(path);
+ File file = new File(path.toNativePath());
if (!file.existsSync()) {
throw new Exception('Cannot find test status file $path');
}
+ int lineNr = 0;
Bill Hesse 2014/02/13 17:05:08 Should we start this at -1, so we get zero-based l
kustermann 2014/02/14 11:52:07 The reason why I chose 1-based line numbering is t
Stream<String> lines =
file.openRead()
.transform(UTF8.decoder)
.transform(new LineSplitter());
- Section current = new Section.always();
- sections.add(current);
+ Section currentSection = new Section.always(statusFile, -1);
+ sections.add(currentSection);
+
lines.listen((String line) {
+ lineNr++;
Match match = SplitComment.firstMatch(line);
line = (match == null) ? "" : match[1];
line = line.trim();
@@ -184,8 +201,9 @@ void ReadConfigurationInto(path, sections, onDone) {
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);
+ currentSection =
+ new Section(statusFile, parser.parseBooleanExpression(), lineNr);
+ sections.add(currentSection);
return;
}
@@ -206,7 +224,8 @@ void ReadConfigurationInto(path, sections, onDone) {
if (issueString == null) issueString = match[2];
}
int issue = issueString != null ? int.parse(issueString) : null;
- current.testRules.add(new TestRule(name, expression, issue));
+ currentSection.testRules.add(
+ new TestRule(currentSection, name, expression, issue, lineNr));
return;
}
@@ -217,11 +236,14 @@ void ReadConfigurationInto(path, sections, onDone) {
class TestRule {
+ final Section section;
Bill Hesse 2014/02/13 17:05:08 I don't see this property being used in any of the
kustermann 2014/02/14 11:52:07 Good point - removed. I think I used it in an earl
+
String name;
SetExpression expression;
int issue;
+ int lineNr;
- TestRule(this.name, this.expression, this.issue);
+ TestRule(this.section, this.name, this.expression, this.issue, this.lineNr);
bool get hasIssue => issue != null;

Powered by Google App Engine
This is Rietveld 408576698