| 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 | 9 |
| 10 import "path.dart"; | 10 import "path.dart"; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 foundImports.add(relativePath.toString()); | 214 foundImports.add(relativePath.toString()); |
| 215 toSearch.add(libraryDir.join(relativePath)); | 215 toSearch.add(libraryDir.join(relativePath)); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 return foundImports; | 220 return foundImports; |
| 221 } | 221 } |
| 222 | 222 |
| 223 Future doMultitest( | 223 Future doMultitest( |
| 224 Path filePath, String outputDir, Path suiteDir, CreateTest doTest) { | 224 Path filePath, |
| 225 String outputDir, |
| 226 Path suiteDir, |
| 227 CreateTest doTest, |
| 228 bool hotReload) { |
| 225 void writeFile(String filepath, String content) { | 229 void writeFile(String filepath, String content) { |
| 226 final File file = new File(filepath); | 230 final File file = new File(filepath); |
| 227 | 231 |
| 228 if (file.existsSync()) { | 232 if (file.existsSync()) { |
| 229 var oldContent = file.readAsStringSync(); | 233 var oldContent = file.readAsStringSync(); |
| 230 if (oldContent == content) { | 234 if (oldContent == content) { |
| 231 // Don't write to the file if the content is the same | 235 // Don't write to the file if the content is the same |
| 232 return; | 236 return; |
| 233 } | 237 } |
| 234 } | 238 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 final Path multitestFilename = | 270 final Path multitestFilename = |
| 267 targetDir.append('${baseFilename}_$key.dart'); | 271 targetDir.append('${baseFilename}_$key.dart'); |
| 268 writeFile(multitestFilename.toNativePath(), tests[key]); | 272 writeFile(multitestFilename.toNativePath(), tests[key]); |
| 269 Set<String> outcome = outcomes[key]; | 273 Set<String> outcome = outcomes[key]; |
| 270 bool hasStaticWarning = outcome.contains('static type warning'); | 274 bool hasStaticWarning = outcome.contains('static type warning'); |
| 271 bool hasRuntimeErrors = outcome.contains('runtime error'); | 275 bool hasRuntimeErrors = outcome.contains('runtime error'); |
| 272 bool hasCompileError = outcome.contains('compile-time error'); | 276 bool hasCompileError = outcome.contains('compile-time error'); |
| 273 bool isNegativeIfChecked = outcome.contains('dynamic type error'); | 277 bool isNegativeIfChecked = outcome.contains('dynamic type error'); |
| 274 bool hasCompileErrorIfChecked = | 278 bool hasCompileErrorIfChecked = |
| 275 outcome.contains('checked mode compile-time error'); | 279 outcome.contains('checked mode compile-time error'); |
| 280 if (hotReload) { |
| 281 if (hasCompileError || hasCompileErrorIfChecked) { |
| 282 // Running a test that expects a compilation error with hot reloading |
| 283 // is redundant with a regular run of the test. |
| 284 continue; |
| 285 } |
| 286 } |
| 276 doTest(multitestFilename, filePath, hasCompileError, hasRuntimeErrors, | 287 doTest(multitestFilename, filePath, hasCompileError, hasRuntimeErrors, |
| 277 isNegativeIfChecked: isNegativeIfChecked, | 288 isNegativeIfChecked: isNegativeIfChecked, |
| 278 hasCompileErrorIfChecked: hasCompileErrorIfChecked, | 289 hasCompileErrorIfChecked: hasCompileErrorIfChecked, |
| 279 hasStaticWarning: hasStaticWarning, | 290 hasStaticWarning: hasStaticWarning, |
| 280 multitestKey: key); | 291 multitestKey: key); |
| 281 } | 292 } |
| 282 | 293 |
| 283 return null; | 294 return null; |
| 284 }); | 295 }); |
| 285 } | 296 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 298 // TestSuite.forDirectory. | 309 // TestSuite.forDirectory. |
| 299 split.removeLast(); | 310 split.removeLast(); |
| 300 } | 311 } |
| 301 String path = '${generatedTestDir.path}/${split.last}'; | 312 String path = '${generatedTestDir.path}/${split.last}'; |
| 302 Directory dir = new Directory(path); | 313 Directory dir = new Directory(path); |
| 303 if (!dir.existsSync()) { | 314 if (!dir.existsSync()) { |
| 304 dir.createSync(); | 315 dir.createSync(); |
| 305 } | 316 } |
| 306 return new Path(new File(path).absolute.path); | 317 return new Path(new File(path).absolute.path); |
| 307 } | 318 } |
| OLD | NEW |