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 /** | 5 /** |
6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
7 * | 7 * |
8 * This library includes: | 8 * This library includes: |
9 * | 9 * |
10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1118 |
1119 // Create the HTML file for the test. | 1119 // Create the HTML file for the test. |
1120 var htmlTest = new File(htmlPath).openSync(mode: FileMode.WRITE); | 1120 var htmlTest = new File(htmlPath).openSync(mode: FileMode.WRITE); |
1121 | 1121 |
1122 var scriptPath = dartWrapperFilename; | 1122 var scriptPath = dartWrapperFilename; |
1123 if (configuration.compiler != Compiler.none) { | 1123 if (configuration.compiler != Compiler.none) { |
1124 scriptPath = compiledDartWrapperFilename; | 1124 scriptPath = compiledDartWrapperFilename; |
1125 } | 1125 } |
1126 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); | 1126 scriptPath = _createUrlPathFromFile(new Path(scriptPath)); |
1127 | 1127 |
1128 if (configuration.compiler == Compiler.dart2js) { | 1128 if (configuration.compiler != Compiler.dartdevc) { |
1129 content = getHtmlContents(fileName, scriptType, scriptPath); | 1129 content = getHtmlContents(fileName, scriptType, scriptPath); |
1130 } else { | 1130 } else { |
1131 var jsDir = new Path(compilationTempDir) | 1131 var jsDir = new Path(compilationTempDir) |
1132 .relativeTo(TestUtils.dartDir) | 1132 .relativeTo(TestUtils.dartDir) |
1133 .toString(); | 1133 .toString(); |
1134 content = dartdevcHtml(nameNoExt, jsDir); | 1134 content = dartdevcHtml(nameNoExt, jsDir); |
1135 } | 1135 } |
1136 | 1136 |
1137 htmlTest.writeStringSync(content); | 1137 htmlTest.writeStringSync(content); |
1138 htmlTest.closeSync(); | 1138 htmlTest.closeSync(); |
1139 } | 1139 } |
1140 | 1140 |
1141 switch (configuration.compiler) { | 1141 switch (configuration.compiler) { |
1142 case Compiler.dart2js: | 1142 case Compiler.dart2js: |
1143 commands.add(_dart2jsCompileCommand(dartWrapperFilename, | 1143 commands.add(_dart2jsCompileCommand(dartWrapperFilename, |
1144 compiledDartWrapperFilename, tempDir, optionsFromFile)); | 1144 compiledDartWrapperFilename, tempDir, optionsFromFile)); |
1145 break; | 1145 break; |
1146 | 1146 |
1147 case Compiler.dartdevc: | 1147 case Compiler.dartdevc: |
1148 commands.add(_dartdevcCompileCommand(dartWrapperFilename, | 1148 commands.add(_dartdevcCompileCommand(dartWrapperFilename, |
1149 '$compilationTempDir/$nameNoExt.js', optionsFromFile)); | 1149 '$compilationTempDir/$nameNoExt.js', optionsFromFile)); |
1150 break; | 1150 break; |
1151 | 1151 |
| 1152 case Compiler.none: |
| 1153 break; |
| 1154 |
1152 default: | 1155 default: |
1153 assert(false); | 1156 assert(false); |
1154 } | 1157 } |
1155 | 1158 |
1156 // Some tests require compiling multiple input scripts. | 1159 // Some tests require compiling multiple input scripts. |
1157 var otherScripts = optionsFromFile['otherScripts'] as List<String>; | 1160 var otherScripts = optionsFromFile['otherScripts'] as List<String>; |
1158 for (var name in otherScripts) { | 1161 for (var name in otherScripts) { |
1159 var namePath = new Path(name); | 1162 var namePath = new Path(name); |
1160 var fromPath = filePath.directoryPath.join(namePath); | 1163 var fromPath = filePath.directoryPath.join(namePath); |
1161 | 1164 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 | 1836 |
1834 bool isTestFile(String filename) { | 1837 bool isTestFile(String filename) { |
1835 // NOTE: We exclude tests and patch files for now. | 1838 // NOTE: We exclude tests and patch files for now. |
1836 return filename.endsWith(".dart") && | 1839 return filename.endsWith(".dart") && |
1837 !filename.endsWith("_test.dart") && | 1840 !filename.endsWith("_test.dart") && |
1838 !filename.contains("_internal/js_runtime/lib"); | 1841 !filename.contains("_internal/js_runtime/lib"); |
1839 } | 1842 } |
1840 | 1843 |
1841 bool get listRecursively => true; | 1844 bool get listRecursively => true; |
1842 } | 1845 } |
OLD | NEW |