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

Unified Diff: tools/testing/dart/multitest.dart

Issue 19774003: Bugfix in multitest.dart: Make sure we copy imported files to the generated_tests directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/multitest.dart
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart
index 11e5ce160c953c63ad4ae0ad8fafaa071230ad8f..fb46867f7ab1c8afa79321fc5d29cbb1c15b4a14 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -150,14 +150,12 @@ class _Annotation {
// Find all relative imports and copy them into the dir that contains
// the generated tests.
-Set<Path> _findAllRelativeImports(Path topLibrary) {
+Set<String> _findAllRelativeImports(Path topLibrary) {
Set<Path> toSearch = new Set<Path>.from([topLibrary]);
- Set<Path> foundImports = new Set<Path>();
+ Set<String> foundImportsAsString = new Set<String>();
ricow1 2013/07/18 17:07:44 any reason to call this AsString other than to mak
kustermann 2013/07/18 17:11:27 No. My first version had two sets. Then I removed
Path libraryDir = topLibrary.directoryPath;
- // Matches #import( or #source( followed by " or ' followed by anything
- // except dart:, dart-ext: or /, at the beginning of a line.
RegExp relativeImportRegExp = new RegExp(
- '^#(import|source)[(]["\'](?!(dart:|dart-ext:|/))([^"\']*)["\']');
+ '^(import|part)\\s+["\'](?!(dart:|dart-ext:|package:|/))([^"\']*)["\']');
while (!toSearch.isEmpty) {
var thisPass = toSearch;
toSearch = new Set<Path>();
@@ -167,7 +165,7 @@ Set<Path> _findAllRelativeImports(Path topLibrary) {
Match match = relativeImportRegExp.firstMatch(line);
if (match != null) {
Path relativePath = new Path(match.group(3));
- if (foundImports.contains(relativePath)) {
+ if (foundImportsAsString.contains(relativePath.toString())) {
continue;
}
if (relativePath.toString().contains('..')) {
@@ -177,13 +175,13 @@ Set<Path> _findAllRelativeImports(Path topLibrary) {
print("relative paths containing .. are not allowed.");
exit(1);
}
- foundImports.add(relativePath);
+ foundImportsAsString.add(relativePath.toString());
toSearch.add(libraryDir.join(relativePath));
}
}
}
}
- return foundImports;
+ return foundImportsAsString;
}
Future doMultitest(Path filePath, String outputDir, Path suiteDir,
@@ -198,9 +196,10 @@ Future doMultitest(Path filePath, String outputDir, Path suiteDir,
assert(targetDir != null);
// Copy all the relative imports of the multitest.
- Set<Path> importsToCopy = _findAllRelativeImports(filePath);
+ Set<String> importsToCopy = _findAllRelativeImports(filePath);
List<Future> futureCopies = [];
- for (Path importPath in importsToCopy) {
+ for (String relativeImport in importsToCopy) {
+ Path importPath = new Path(relativeImport);
// Make sure the target directory exists.
Path importDir = importPath.directoryPath;
if (!importDir.isEmpty) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698