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

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

Issue 10351011: Change Platform members to getters instead of methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding new test binaries Created 8 years, 7 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 | « tools/testing/bin/windows/dart.exe ('k') | tools/testing/dart/test_options.dart » ('j') | 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) 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("multitest"); 5 #library("multitest");
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("test_suite.dart"); 8 #import("test_suite.dart");
9 9
10 // Multitests are Dart test scripts containing lines of the form 10 // Multitests are Dart test scripts containing lines of the form
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 .map((s) => s.trim()); 148 .map((s) => s.trim());
149 return annotation; 149 return annotation;
150 } 150 }
151 } 151 }
152 152
153 // Find all relative imports and copy them into the dir that contains 153 // Find all relative imports and copy them into the dir that contains
154 // the generated tests. 154 // the generated tests.
155 Set<String> _findAllRelativeImports(String topLibrary) { 155 Set<String> _findAllRelativeImports(String topLibrary) {
156 Set<String> toSearch = new Set<String>.from([topLibrary]); 156 Set<String> toSearch = new Set<String>.from([topLibrary]);
157 Set<String> foundImports = new HashSet<String>(); 157 Set<String> foundImports = new HashSet<String>();
158 String pathSep = Platform.pathSeparator(); 158 String pathSep = Platform.pathSeparator;
159 int end = topLibrary.lastIndexOf(pathSep); 159 int end = topLibrary.lastIndexOf(pathSep);
160 String libraryDir = topLibrary.substring(0, end); 160 String libraryDir = topLibrary.substring(0, end);
161 161
162 // Matches #import( or #source( followed by " or ' followed by anything 162 // Matches #import( or #source( followed by " or ' followed by anything
163 // except dart: or /, at the beginning of a line. 163 // except dart: or /, at the beginning of a line.
164 RegExp relativeImportRegExp = 164 RegExp relativeImportRegExp =
165 const RegExp('^#(import|source)[(]["\'](?!(dart:|/))([^"\']*)["\']'); 165 const RegExp('^#(import|source)[(]["\'](?!(dart:|/))([^"\']*)["\']');
166 while (!toSearch.isEmpty()) { 166 while (!toSearch.isEmpty()) {
167 var thisPass = toSearch; 167 var thisPass = toSearch;
168 toSearch = new HashSet<String>(); 168 toSearch = new HashSet<String>();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 bool hasRuntimeErrors, 202 bool hasRuntimeErrors,
203 Set<String> multitestOutcome]), 203 Set<String> multitestOutcome]),
204 Function multitestDone) { 204 Function multitestDone) {
205 // Each new test is a single String value in the Map tests. 205 // Each new test is a single String value in the Map tests.
206 Map<String, String> tests = new Map<String, String>(); 206 Map<String, String> tests = new Map<String, String>();
207 Map<String, Set<String>> outcomes = new Map<String, Set<String>>(); 207 Map<String, Set<String>> outcomes = new Map<String, Set<String>>();
208 ExtractTestsFromMultitest(filename, tests, outcomes); 208 ExtractTestsFromMultitest(filename, tests, outcomes);
209 209
210 String directory = CreateMultitestDirectory(outputDir, testDir); 210 String directory = CreateMultitestDirectory(outputDir, testDir);
211 Expect.isNotNull(directory); 211 Expect.isNotNull(directory);
212 String pathSep = Platform.pathSeparator(); 212 String pathSep = Platform.pathSeparator;
213 int start = filename.lastIndexOf(pathSep) + 1; 213 int start = filename.lastIndexOf(pathSep) + 1;
214 int end = filename.indexOf('.dart', start); 214 int end = filename.indexOf('.dart', start);
215 String baseFilename = filename.substring(start, end); 215 String baseFilename = filename.substring(start, end);
216 String sourceDirectory = filename.substring(0, start - 1); 216 String sourceDirectory = filename.substring(0, start - 1);
217 Set<String> importsToCopy = _findAllRelativeImports(filename); 217 Set<String> importsToCopy = _findAllRelativeImports(filename);
218 Directory destDir = new Directory("directory"); 218 Directory destDir = new Directory("directory");
219 for (String import in importsToCopy) { 219 for (String import in importsToCopy) {
220 File source = new File('$sourceDirectory/$import'); 220 File source = new File('$sourceDirectory/$import');
221 var dest = new File('$directory/$import'); 221 var dest = new File('$directory/$import');
222 var basenameStart = import.lastIndexOf('/'); 222 var basenameStart = import.lastIndexOf('/');
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // TestSuite.forDirectory. 268 // TestSuite.forDirectory.
269 split.removeLast(); 269 split.removeLast();
270 } 270 }
271 String path = '${generatedTestDir.path}/${split.last()}'; 271 String path = '${generatedTestDir.path}/${split.last()}';
272 Directory dir = new Directory(path); 272 Directory dir = new Directory(path);
273 if (!dir.existsSync()) { 273 if (!dir.existsSync()) {
274 dir.createSync(); 274 dir.createSync();
275 } 275 }
276 return path; 276 return path;
277 } 277 }
OLDNEW
« no previous file with comments | « tools/testing/bin/windows/dart.exe ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698