| OLD | NEW |
| 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 library status_file_parser; | 5 library status_file_parser; |
| 6 | 6 |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:convert" show LineSplitter, UTF8; | 8 import "dart:convert" show LineSplitter, UTF8; |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 | 10 |
| 11 import "path.dart"; | 11 import "path.dart"; |
| 12 import "status_expression.dart"; | 12 import "status_expression.dart"; |
| 13 | 13 |
| 14 import '../expectation.dart' show | 14 import '../expectation.dart' show Expectation, ExpectationSet; |
| 15 Expectation, | |
| 16 ExpectationSet; | |
| 17 | 15 |
| 18 final RegExp SplitComment = new RegExp("^([^#]*)(#.*)?\$"); | 16 final RegExp SplitComment = new RegExp("^([^#]*)(#.*)?\$"); |
| 19 final RegExp HeaderPattern = new RegExp(r"^\[([^\]]+)\]"); | 17 final RegExp HeaderPattern = new RegExp(r"^\[([^\]]+)\]"); |
| 20 final RegExp RulePattern = new RegExp(r"\s*([^: ]*)\s*:(.*)"); | 18 final RegExp RulePattern = new RegExp(r"\s*([^: ]*)\s*:(.*)"); |
| 21 final RegExp IssueNumberPattern = new RegExp("[Ii]ssue ([0-9]+)"); | 19 final RegExp IssueNumberPattern = new RegExp("[Ii]ssue ([0-9]+)"); |
| 22 | 20 |
| 23 class StatusFile { | 21 class StatusFile { |
| 24 final Path location; | 22 final Path location; |
| 25 | 23 |
| 26 StatusFile(this.location); | 24 StatusFile(this.location); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 42 : testRules = new List<TestRule>(); | 40 : testRules = new List<TestRule>(); |
| 43 | 41 |
| 44 bool isEnabled(environment) => | 42 bool isEnabled(environment) => |
| 45 condition == null || condition.evaluate(environment); | 43 condition == null || condition.evaluate(environment); |
| 46 | 44 |
| 47 String toString() { | 45 String toString() { |
| 48 return "Section: $condition"; | 46 return "Section: $condition"; |
| 49 } | 47 } |
| 50 } | 48 } |
| 51 | 49 |
| 52 Future<TestExpectations> ReadTestExpectations( | 50 Future<TestExpectations> ReadTestExpectations(List<String> statusFilePaths, |
| 53 List<String> statusFilePaths, Map environment, | 51 Map environment, ExpectationSet expectationSet) { |
| 54 ExpectationSet expectationSet) { | |
| 55 var testExpectations = new TestExpectations(expectationSet); | 52 var testExpectations = new TestExpectations(expectationSet); |
| 56 return Future.wait(statusFilePaths.map((String statusFile) { | 53 return Future.wait(statusFilePaths.map((String statusFile) { |
| 57 return ReadTestExpectationsInto(testExpectations, statusFile, environment); | 54 return ReadTestExpectationsInto(testExpectations, statusFile, environment); |
| 58 })).then((_) => testExpectations); | 55 })).then((_) => testExpectations); |
| 59 } | 56 } |
| 60 | 57 |
| 61 Future ReadTestExpectationsInto( | 58 Future ReadTestExpectationsInto( |
| 62 TestExpectations expectations, String statusFilePath, environment) { | 59 TestExpectations expectations, String statusFilePath, environment) { |
| 63 var completer = new Completer(); | 60 var completer = new Completer(); |
| 64 List<Section> sections = new List<Section>(); | 61 List<Section> sections = new List<Section>(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 241 } |
| 245 regExps[i] = regExp; | 242 regExps[i] = regExp; |
| 246 } | 243 } |
| 247 _keyToRegExps[key] = regExps; | 244 _keyToRegExps[key] = regExps; |
| 248 }); | 245 }); |
| 249 | 246 |
| 250 _regExpCache = null; | 247 _regExpCache = null; |
| 251 _preprocessed = true; | 248 _preprocessed = true; |
| 252 } | 249 } |
| 253 } | 250 } |
| OLD | NEW |