| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 List<String> statusFilePaths; | 205 List<String> statusFilePaths; |
| 206 Function doTest; | 206 Function doTest; |
| 207 Function doDone; | 207 Function doDone; |
| 208 int activeTestGenerators = 0; | 208 int activeTestGenerators = 0; |
| 209 bool listingDone = false; | 209 bool listingDone = false; |
| 210 TestExpectations testExpectations; | 210 TestExpectations testExpectations; |
| 211 List<TestInformation> cachedTests; | 211 List<TestInformation> cachedTests; |
| 212 final String dartDir; | 212 final String dartDir; |
| 213 Function globalTemporaryDirectory; | 213 Function globalTemporaryDirectory; |
| 214 Predicate<String> isTestFilePredicate; | 214 Predicate<String> isTestFilePredicate; |
| 215 bool _listRecursive; |
| 215 | 216 |
| 216 StandardTestSuite(Map this.configuration, | 217 StandardTestSuite(Map this.configuration, |
| 217 String this.suiteName, | 218 String this.suiteName, |
| 218 String this.directoryPath, | 219 String this.directoryPath, |
| 219 List<String> this.statusFilePaths, | 220 List<String> this.statusFilePaths, |
| 220 [Predicate<String> this.isTestFilePredicate]) | 221 [Predicate<String> this.isTestFilePredicate, |
| 221 : dartDir = TestUtils.dartDir(); | 222 bool recursive = false]) |
| 223 : dartDir = TestUtils.dartDir(), _listRecursive = recursive; |
| 222 | 224 |
| 223 /** | 225 /** |
| 224 * Creates a test suite whose file organization matches an expected structure. | 226 * Creates a test suite whose file organization matches an expected structure. |
| 225 * To use this, your suite should look like: | 227 * To use this, your suite should look like: |
| 226 * | 228 * |
| 227 * dart/ | 229 * dart/ |
| 228 * path/ | 230 * path/ |
| 229 * to/ | 231 * to/ |
| 230 * mytestsuite/ | 232 * mytestsuite/ |
| 231 * mytestsuite.status | 233 * mytestsuite.status |
| (...skipping 14 matching lines...) Expand all Loading... |
| 246 * instead of having to create a custom [StandardTestSuite] subclass. In | 248 * instead of having to create a custom [StandardTestSuite] subclass. In |
| 247 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] | 249 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] |
| 248 * in test.dart, this will all be set up for you. | 250 * in test.dart, this will all be set up for you. |
| 249 */ | 251 */ |
| 250 factory StandardTestSuite.forDirectory( | 252 factory StandardTestSuite.forDirectory( |
| 251 Map configuration, String directory) { | 253 Map configuration, String directory) { |
| 252 final name = directory.substring(directory.lastIndexOf('/') + 1); | 254 final name = directory.substring(directory.lastIndexOf('/') + 1); |
| 253 | 255 |
| 254 return new StandardTestSuite(configuration, | 256 return new StandardTestSuite(configuration, |
| 255 name, directory, ['$directory/$name.status'], | 257 name, directory, ['$directory/$name.status'], |
| 256 (filename) => filename.endsWith('_test.dart')); | 258 (filename) => filename.endsWith('_test.dart'), |
| 259 recursive: true); |
| 257 } | 260 } |
| 258 | 261 |
| 259 /** | 262 /** |
| 260 * The default implementation assumes a file is a test if | 263 * The default implementation assumes a file is a test if |
| 261 * it ends in "Test.dart". | 264 * it ends in "Test.dart". |
| 262 */ | 265 */ |
| 263 bool isTestFile(String filename) { | 266 bool isTestFile(String filename) { |
| 264 // Use the specified predicate, if provided. | 267 // Use the specified predicate, if provided. |
| 265 if (isTestFilePredicate != null) return isTestFilePredicate(filename); | 268 if (isTestFilePredicate != null) return isTestFilePredicate(filename); |
| 266 | 269 |
| 267 return filename.endsWith("Test.dart"); | 270 return filename.endsWith("Test.dart"); |
| 268 } | 271 } |
| 269 | 272 |
| 270 bool listRecursively() => false; | 273 bool listRecursively() => _listRecursive; |
| 271 | 274 |
| 272 String shellPath() => TestUtils.dartShellFileName(configuration); | 275 String shellPath() => TestUtils.dartShellFileName(configuration); |
| 273 | 276 |
| 274 List<String> additionalOptions(String filename) => []; | 277 List<String> additionalOptions(String filename) => []; |
| 275 | 278 |
| 276 void forEachTest(Function onTest, Map testCache, String globalTempDir(), | 279 void forEachTest(Function onTest, Map testCache, String globalTempDir(), |
| 277 [Function onDone = null]) { | 280 [Function onDone = null]) { |
| 278 // If DumpRenderTree/Dartium is required, and not yet updated, | 281 // If DumpRenderTree/Dartium is required, and not yet updated, |
| 279 // wait for update. | 282 // wait for update. |
| 280 var updater = runtimeUpdater(configuration['runtime']); | 283 var updater = runtimeUpdater(configuration['runtime']); |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 * $noCrash tests are expected to be flaky but not crash | 1393 * $noCrash tests are expected to be flaky but not crash |
| 1391 * $pass tests are expected to pass | 1394 * $pass tests are expected to pass |
| 1392 * $failOk tests are expected to fail that we won't fix | 1395 * $failOk tests are expected to fail that we won't fix |
| 1393 * $fail tests are expected to fail that we should fix | 1396 * $fail tests are expected to fail that we should fix |
| 1394 * $crash tests are expected to crash that we should fix | 1397 * $crash tests are expected to crash that we should fix |
| 1395 * $timeout tests are allowed to timeout | 1398 * $timeout tests are allowed to timeout |
| 1396 """; | 1399 """; |
| 1397 print(report); | 1400 print(report); |
| 1398 } | 1401 } |
| 1399 } | 1402 } |
| OLD | NEW |