| 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:io"); | 7 #import("dart:io"); |
| 8 #import("status_expression.dart"); | 8 #import("status_expression.dart"); |
| 9 | 9 |
| 10 /** Possible outcomes of running a test. */ | 10 /** Possible outcomes of running a test. */ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 Section current = new Section.always(); | 71 Section current = new Section.always(); |
| 72 sections.add(current); | 72 sections.add(current); |
| 73 | 73 |
| 74 lines.onLine = () { | 74 lines.onLine = () { |
| 75 String line; | 75 String line; |
| 76 while ((line = lines.readLine()) != null) { | 76 while ((line = lines.readLine()) != null) { |
| 77 Match match = StripComment.firstMatch(line); | 77 Match match = StripComment.firstMatch(line); |
| 78 line = (match == null) ? "" : match[0]; | 78 line = (match == null) ? "" : match[0]; |
| 79 line = line.trim(); | 79 line = line.trim(); |
| 80 if (line.isEmpty()) continue; | 80 if (line.isEmpty) continue; |
| 81 | 81 |
| 82 match = HeaderPattern.firstMatch(line); | 82 match = HeaderPattern.firstMatch(line); |
| 83 if (match != null) { | 83 if (match != null) { |
| 84 String condition_string = match[1].trim(); | 84 String condition_string = match[1].trim(); |
| 85 List<String> tokens = new Tokenizer(condition_string).tokenize(); | 85 List<String> tokens = new Tokenizer(condition_string).tokenize(); |
| 86 ExpressionParser parser = new ExpressionParser(new Scanner(tokens)); | 86 ExpressionParser parser = new ExpressionParser(new Scanner(tokens)); |
| 87 current = new Section(parser.parseBooleanExpression()); | 87 current = new Section(parser.parseBooleanExpression()); |
| 88 sections.add(current); | 88 sections.add(current); |
| 89 continue; | 89 continue; |
| 90 } | 90 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 for (var i = 0; i < regExps.length; i++) { | 170 for (var i = 0; i < regExps.length; i++) { |
| 171 if (!regExps[i].hasMatch(splitFilename[i])) return; | 171 if (!regExps[i].hasMatch(splitFilename[i])) return; |
| 172 } | 172 } |
| 173 // If all components of the status file key matches the filename | 173 // If all components of the status file key matches the filename |
| 174 // add the expectations to the result. | 174 // add the expectations to the result. |
| 175 result.addAll(expectation); | 175 result.addAll(expectation); |
| 176 }); | 176 }); |
| 177 | 177 |
| 178 // If no expectations were found the expectation is that the test | 178 // If no expectations were found the expectation is that the test |
| 179 // passes. | 179 // passes. |
| 180 if (result.isEmpty()) { | 180 if (result.isEmpty) { |
| 181 result.add(PASS); | 181 result.add(PASS); |
| 182 } | 182 } |
| 183 return result; | 183 return result; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Preprocess the expectations for matching against | 186 // Preprocess the expectations for matching against |
| 187 // filenames. Generate lists of regular expressions once and for all | 187 // filenames. Generate lists of regular expressions once and for all |
| 188 // for each key. | 188 // for each key. |
| 189 void _preprocessForMatching() { | 189 void _preprocessForMatching() { |
| 190 if (_preprocessed) return; | 190 if (_preprocessed) return; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 206 } | 206 } |
| 207 regExps[i] = regExp; | 207 regExps[i] = regExp; |
| 208 } | 208 } |
| 209 _keyToRegExps[key] = regExps; | 209 _keyToRegExps[key] = regExps; |
| 210 }); | 210 }); |
| 211 | 211 |
| 212 _regExpCache = null; | 212 _regExpCache = null; |
| 213 _preprocessed = true; | 213 _preprocessed = true; |
| 214 } | 214 } |
| 215 } | 215 } |
| OLD | NEW |