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

Side by Side Diff: tools/testing/dart/status_file_parser.dart

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments by ager@ Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/stub-generator/test_config.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 7
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 onDone(); 60 onDone();
61 } 61 }
62 62
63 ReadConfigurationInto(statusFilePath, sections, sectionsRead); 63 ReadConfigurationInto(statusFilePath, sections, sectionsRead);
64 } 64 }
65 65
66 void ReadConfigurationInto(path, sections, onDone) { 66 void ReadConfigurationInto(path, sections, onDone) {
67 File file = new File(getFilename(path)); 67 File file = new File(getFilename(path));
68 if (!file.existsSync()) return; // TODO(whesse): Handle missing file. 68 if (!file.existsSync()) return; // TODO(whesse): Handle missing file.
69 FileInputStream file_stream = file.openInputStream(); 69 InputStream file_stream = file.openInputStream();
70 StringInputStream lines = new StringInputStream(file_stream); 70 StringInputStream lines = new StringInputStream(file_stream);
71 71
72 Section current = new Section.always(); 72 Section current = new Section.always();
73 sections.add(current); 73 sections.add(current);
74 String prefix = ""; 74 String prefix = "";
75 75
76 lines.lineHandler = () { 76 lines.lineHandler = () {
77 String line; 77 String line;
78 while ((line = lines.readLine()) != null) { 78 while ((line = lines.readLine()) != null) {
79 Match match = StripComment.firstMatch(line); 79 Match match = StripComment.firstMatch(line);
(...skipping 27 matching lines...) Expand all
107 if (match != null) { 107 if (match != null) {
108 prefix = match[1]; 108 prefix = match[1];
109 continue; 109 continue;
110 } 110 }
111 111
112 print("unmatched line: $line"); 112 print("unmatched line: $line");
113 } 113 }
114 }; 114 };
115 115
116 lines.closeHandler = () { 116 lines.closeHandler = () {
117 file_stream.close();
118 onDone(); 117 onDone();
119 }; 118 };
120 } 119 }
121 120
122 121
123 class TestRule { 122 class TestRule {
124 String name; 123 String name;
125 SetExpression expression; 124 SetExpression expression;
126 125
127 TestRule(this.name, this.expression); 126 TestRule(this.name, this.expression);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 243 }
245 regExps[i] = regExp; 244 regExps[i] = regExp;
246 } 245 }
247 _keyToRegExps[key] = regExps; 246 _keyToRegExps[key] = regExps;
248 }); 247 });
249 248
250 _regExpCache = null; 249 _regExpCache = null;
251 _preprocessed = true; 250 _preprocessed = true;
252 } 251 }
253 } 252 }
OLDNEW
« no previous file with comments | « tests/stub-generator/test_config.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698