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

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

Issue 8772008: Add line handler to string stream (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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/standalone/src/StringStreamTest.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 23 matching lines...) Expand all
34 } 34 }
35 35
36 36
37 // Helper method to be able to run the test from the runtime 37 // Helper method to be able to run the test from the runtime
38 // directory, or the top directory. 38 // directory, or the top directory.
39 String getFilename(String path) => 39 String getFilename(String path) =>
40 new File(path).existsSync() ? path : '../$path'; 40 new File(path).existsSync() ? path : '../$path';
41 41
42 String getDirname(String path) => 42 String getDirname(String path) =>
43 new Directory(path).existsSync() ? path : '../$path'; 43 new Directory(path).existsSync() ? path : '../$path';
44 44
45 void ReadTestExpectationsInto(TestExpectations expectations, 45 void ReadTestExpectationsInto(TestExpectations expectations,
46 String statusFilePath, 46 String statusFilePath,
47 environment) { 47 environment) {
48 List<Section> sections = new List<Section>(); 48 List<Section> sections = new List<Section>();
49 ReadConfigurationInto(statusFilePath, sections); 49 ReadConfigurationInto(statusFilePath, sections);
50 50
51 for (Section section in sections) { 51 for (Section section in sections) {
52 if (section.isEnabled(environment)) { 52 if (section.isEnabled(environment)) {
53 for (var rule in section.testRules) { 53 for (var rule in section.testRules) {
54 expectations.addRule(rule, environment); 54 expectations.addRule(rule, environment);
55 } 55 }
56 } 56 }
57 } 57 }
58 } 58 }
59 59
60 void ReadConfigurationInto(path, sections) { 60 void ReadConfigurationInto(path, sections) {
61 File file = new File(getFilename(path)); 61 File file = new File(getFilename(path));
62 if (!file.existsSync()) return; // TODO(whesse): Handle missing file. 62 if (!file.existsSync()) return; // TODO(whesse): Handle missing file.
63 FileInputStream file_stream = file.openInputStream(); 63 FileInputStream file_stream = file.openInputStream();
64 StringInputStream lines = new StringInputStream(file_stream); 64 StringInputStream lines = new StringInputStream(file_stream);
65 65
66 Section current = new Section.always(); 66 Section current = new Section.always();
67 sections.add(current); 67 sections.add(current);
68 String prefix = ""; 68 String prefix = "";
69 69
70 String line; 70 String line;
71 while ((line = lines.readLine()) != null) { 71 while ((line = lines.readLine()) != null) {
72 Match match = StripComment.firstMatch(line); 72 Match match = StripComment.firstMatch(line);
73 line = (match == null) ? "" : match[0]; 73 line = (match == null) ? "" : match[0];
74 line = line.trim(); 74 line = line.trim();
75 if (line.isEmpty()) continue; 75 if (line.isEmpty()) continue;
76 76
77 match = HeaderPattern.firstMatch(line); 77 match = HeaderPattern.firstMatch(line);
78 if (match != null) { 78 if (match != null) {
79 String condition_string = match[1].trim(); 79 String condition_string = match[1].trim();
80 List<String> tokens = new Tokenizer(condition_string).tokenize(); 80 List<String> tokens = new Tokenizer(condition_string).tokenize();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 regExps[i] = regExp; 234 regExps[i] = regExp;
235 } 235 }
236 _keyToRegExps[key] = regExps; 236 _keyToRegExps[key] = regExps;
237 }); 237 });
238 238
239 _regExpCache = null; 239 _regExpCache = null;
240 _preprocessed = true; 240 _preprocessed = true;
241 } 241 }
242 } 242 }
OLDNEW
« no previous file with comments | « tests/standalone/src/StringStreamTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698