| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 ReadConfigurationInto(statusFilePath, sections, sectionsRead); | 54 ReadConfigurationInto(statusFilePath, sections, sectionsRead); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ReadConfigurationInto(path, sections, onDone) { | 57 void ReadConfigurationInto(path, sections, onDone) { |
| 58 File file = new File(path); | 58 File file = new File(path); |
| 59 if (!file.existsSync()) { | 59 if (!file.existsSync()) { |
| 60 throw new Exception('Cannot find test status file $path'); | 60 throw new Exception('Cannot find test status file $path'); |
| 61 } | 61 } |
| 62 // TODO(1797): When the checked in binary is updated to include the | 62 InputStream file_stream = file.openInputStream(); |
| 63 // openInputStreamSync API remove this try/catch. | |
| 64 InputStream file_stream; | |
| 65 try { | |
| 66 file_stream = file.openInputStreamSync(); | |
| 67 } catch (NoSuchMethodException e) { | |
| 68 file_stream = file.openInputStream(); | |
| 69 } | |
| 70 StringInputStream lines = new StringInputStream(file_stream); | 63 StringInputStream lines = new StringInputStream(file_stream); |
| 71 | 64 |
| 72 Section current = new Section.always(); | 65 Section current = new Section.always(); |
| 73 sections.add(current); | 66 sections.add(current); |
| 74 String prefix = ""; | 67 String prefix = ""; |
| 75 | 68 |
| 76 lines.lineHandler = () { | 69 lines.lineHandler = () { |
| 77 String line; | 70 String line; |
| 78 while ((line = lines.readLine()) != null) { | 71 while ((line = lines.readLine()) != null) { |
| 79 Match match = StripComment.firstMatch(line); | 72 Match match = StripComment.firstMatch(line); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 205 } |
| 213 regExps[i] = regExp; | 206 regExps[i] = regExp; |
| 214 } | 207 } |
| 215 _keyToRegExps[key] = regExps; | 208 _keyToRegExps[key] = regExps; |
| 216 }); | 209 }); |
| 217 | 210 |
| 218 _regExpCache = null; | 211 _regExpCache = null; |
| 219 _preprocessed = true; | 212 _preprocessed = true; |
| 220 } | 213 } |
| 221 } | 214 } |
| OLD | NEW |