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

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

Issue 10699006: Add test for native extensions that copies the extension to a test directory and runs it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix comment and long line in multitest.dart Created 8 years, 5 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
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
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:, dart-ext: or /, at the beginning of a line.
164 RegExp relativeImportRegExp = 164 RegExp relativeImportRegExp = const RegExp(
165 const RegExp('^#(import|source)[(]["\'](?!(dart:|/))([^"\']*)["\']'); 165 '^#(import|source)[(]["\'](?!(dart:|dart-ext:|/))([^"\']*)["\']');
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>();
169 for (String filename in thisPass) { 169 for (String filename in thisPass) {
170 File f = new File(filename); 170 File f = new File(filename);
171 for (String line in f.readAsLinesSync()) { 171 for (String line in f.readAsLinesSync()) {
172 Match match = relativeImportRegExp.firstMatch(line); 172 Match match = relativeImportRegExp.firstMatch(line);
173 if (match != null) { 173 if (match != null) {
174 String relativePath = match.group(3); 174 String relativePath = match.group(3);
175 if (foundImports.contains(relativePath)) { 175 if (foundImports.contains(relativePath)) {
(...skipping 92 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
« tests/standalone/io/test_extension_test.dart ('K') | « tests/standalone/standalone.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698