OLD | NEW |
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:async"; | 7 import "dart:async"; |
8 import "dart:io"; | 8 import "dart:io"; |
9 import "test_suite.dart"; | 9 import "test_suite.dart"; |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 Path importDir = importPath.directoryPath; | 209 Path importDir = importPath.directoryPath; |
210 if (!importDir.isEmpty) { | 210 if (!importDir.isEmpty) { |
211 TestUtils.mkdirRecursive(targetDir, importDir); | 211 TestUtils.mkdirRecursive(targetDir, importDir); |
212 } | 212 } |
213 // Copy file. | 213 // Copy file. |
214 futureCopies.add(TestUtils.copyFile(sourceDir.join(importPath), | 214 futureCopies.add(TestUtils.copyFile(sourceDir.join(importPath), |
215 targetDir.join(importPath))); | 215 targetDir.join(importPath))); |
216 } | 216 } |
217 | 217 |
218 // Wait until all imports are copied before scheduling test cases. | 218 // Wait until all imports are copied before scheduling test cases. |
219 return Futures.wait(futureCopies).then((_) { | 219 return Future.wait(futureCopies).then((_) { |
220 String baseFilename = filePath.filenameWithoutExtension; | 220 String baseFilename = filePath.filenameWithoutExtension; |
221 for (String key in tests.keys) { | 221 for (String key in tests.keys) { |
222 final Path multitestFilename = | 222 final Path multitestFilename = |
223 targetDir.append('${baseFilename}_$key.dart'); | 223 targetDir.append('${baseFilename}_$key.dart'); |
224 final File file = new File.fromPath(multitestFilename); | 224 final File file = new File.fromPath(multitestFilename); |
225 | 225 |
226 file.createSync(); | 226 file.createSync(); |
227 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); | 227 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); |
228 var bytes = tests[key].charCodes; | 228 var bytes = tests[key].charCodes; |
229 openedFile.writeListSync(bytes, 0, bytes.length); | 229 openedFile.writeListSync(bytes, 0, bytes.length); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // TestSuite.forDirectory. | 261 // TestSuite.forDirectory. |
262 split.removeLast(); | 262 split.removeLast(); |
263 } | 263 } |
264 String path = '${generatedTestDir.path}/${split.last}'; | 264 String path = '${generatedTestDir.path}/${split.last}'; |
265 Directory dir = new Directory(path); | 265 Directory dir = new Directory(path); |
266 if (!dir.existsSync()) { | 266 if (!dir.existsSync()) { |
267 dir.createSync(); | 267 dir.createSync(); |
268 } | 268 } |
269 return new Path.fromNative(new File(path).fullPathSync()); | 269 return new Path.fromNative(new File(path).fullPathSync()); |
270 } | 270 } |
OLD | NEW |