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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 TestExpectations testExpectations; | 217 TestExpectations testExpectations; |
218 List<TestInformation> cachedTests; | 218 List<TestInformation> cachedTests; |
219 final Path dartDir; | 219 final Path dartDir; |
220 Predicate<String> isTestFilePredicate; | 220 Predicate<String> isTestFilePredicate; |
221 bool _listRecursive; | 221 bool _listRecursive; |
222 | 222 |
223 StandardTestSuite(this.configuration, | 223 StandardTestSuite(this.configuration, |
224 this.suiteName, | 224 this.suiteName, |
225 Path suiteDirectory, | 225 Path suiteDirectory, |
226 this.statusFilePaths, | 226 this.statusFilePaths, |
227 [this.isTestFilePredicate, | 227 {this.isTestFilePredicate, |
228 bool recursive = false]) | 228 bool recursive: false}) |
229 : dartDir = TestUtils.dartDir(), _listRecursive = recursive, | 229 : dartDir = TestUtils.dartDir(), _listRecursive = recursive, |
230 suiteDir = TestUtils.dartDir().join(suiteDirectory); | 230 suiteDir = TestUtils.dartDir().join(suiteDirectory); |
231 | 231 |
232 /** | 232 /** |
233 * Creates a test suite whose file organization matches an expected structure. | 233 * Creates a test suite whose file organization matches an expected structure. |
234 * To use this, your suite should look like: | 234 * To use this, your suite should look like: |
235 * | 235 * |
236 * dart/ | 236 * dart/ |
237 * path/ | 237 * path/ |
238 * to/ | 238 * to/ |
(...skipping 17 matching lines...) Expand all Loading... |
256 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] | 256 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] |
257 * in test.dart, this will all be set up for you. | 257 * in test.dart, this will all be set up for you. |
258 */ | 258 */ |
259 factory StandardTestSuite.forDirectory( | 259 factory StandardTestSuite.forDirectory( |
260 Map configuration, Path directory) { | 260 Map configuration, Path directory) { |
261 final name = directory.filename; | 261 final name = directory.filename; |
262 | 262 |
263 return new StandardTestSuite(configuration, | 263 return new StandardTestSuite(configuration, |
264 name, directory, | 264 name, directory, |
265 ['$directory/$name.status', '$directory/${name}_dart2js.status'], | 265 ['$directory/$name.status', '$directory/${name}_dart2js.status'], |
266 (filename) => filename.endsWith('_test.dart'), | 266 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), |
267 recursive: true); | 267 recursive: true); |
268 } | 268 } |
269 | 269 |
270 /** | 270 /** |
271 * The default implementation assumes a file is a test if | 271 * The default implementation assumes a file is a test if |
272 * it ends in "Test.dart". | 272 * it ends in "Test.dart". |
273 */ | 273 */ |
274 bool isTestFile(String filename) { | 274 bool isTestFile(String filename) { |
275 // Use the specified predicate, if provided. | 275 // Use the specified predicate, if provided. |
276 if (isTestFilePredicate != null) return isTestFilePredicate(filename); | 276 if (isTestFilePredicate != null) return isTestFilePredicate(filename); |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 * $noCrash tests are expected to be flaky but not crash | 1467 * $noCrash tests are expected to be flaky but not crash |
1468 * $pass tests are expected to pass | 1468 * $pass tests are expected to pass |
1469 * $failOk tests are expected to fail that we won't fix | 1469 * $failOk tests are expected to fail that we won't fix |
1470 * $fail tests are expected to fail that we should fix | 1470 * $fail tests are expected to fail that we should fix |
1471 * $crash tests are expected to crash that we should fix | 1471 * $crash tests are expected to crash that we should fix |
1472 * $timeout tests are allowed to timeout | 1472 * $timeout tests are allowed to timeout |
1473 """; | 1473 """; |
1474 print(report); | 1474 print(report); |
1475 } | 1475 } |
1476 } | 1476 } |
OLD | NEW |