OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** | |
6 * A test execution pipeline is made up of a list of tasks. Each task is a | |
7 * subclass of [PipelineTask]. | |
8 */ | |
9 abstract class PipelineTask { | |
10 | |
11 abstract void execute(Path testfile, List stdout, List stderr, | |
12 bool verboseLogging, Function exitHandler); | |
13 | |
14 void cleanup(Path testfile, List stdout, List stderr, | |
15 bool verboseLogging, bool keepTestFiles) { | |
Siggi Cherem (dart-lang)
2012/08/30 16:46:40
ditto here and below (shorter names)
| |
16 } | |
17 | |
18 void deleteFiles(List templates, Path testfile, | |
19 bool verboseLogging, bool keepTestFiles, | |
20 List stdout) { | |
21 if (!keepTestFiles) { | |
22 for (var template in templates) { | |
23 var fname = expandMacros(template, testfile); | |
24 deleteFile(fname); | |
25 if (verboseLogging) { | |
26 stdout.add('Removing $fname'); | |
27 } | |
28 } | |
29 } | |
30 } | |
31 | |
32 String flattenPath(String path) { | |
33 return makePathAbsolute(path). | |
34 replaceAll(Platform.pathSeparator, "_"). | |
35 replaceAll(":",""); | |
36 } | |
37 | |
38 // This takes a string used in a template and does macro expansion for | |
39 // a specific test file. | |
40 String expandMacros(String template, Path testfile) { | |
41 String path = makePathAbsolute(testfile.directoryPath.toString()); | |
42 return template. | |
43 replaceAll(Macros.fullFilePath, testfile.toNativePath()). | |
44 replaceAll(Macros.filenameNoExtension, | |
45 testfile.filenameWithoutExtension). | |
46 replaceAll(Macros.filename, testfile.filename). | |
47 replaceAll(Macros.directory, path). | |
48 replaceAll(Macros.flattenedDirectory, flattenPath(path)); | |
49 } | |
50 } | |
51 | |
52 | |
OLD | NEW |