| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 /** | 223 /** |
| 224 * Creates a test suite whose file organization matches an expected structure. | 224 * Creates a test suite whose file organization matches an expected structure. |
| 225 * To use this, your suite should look like: | 225 * To use this, your suite should look like: |
| 226 * | 226 * |
| 227 * dart/ | 227 * dart/ |
| 228 * path/ | 228 * path/ |
| 229 * to/ | 229 * to/ |
| 230 * mytestsuite/ | 230 * mytestsuite/ |
| 231 * mytestsuite.status | 231 * mytestsuite.status |
| 232 * example1_tests.dart | 232 * example1_test.dart |
| 233 * example2_tests.dart | 233 * example2_test.dart |
| 234 * example3_tests.dart | 234 * example3_test.dart |
| 235 * | 235 * |
| 236 * The important parts: | 236 * The important parts: |
| 237 * | 237 * |
| 238 * * The leaf directory name is the name of your test suite. | 238 * * The leaf directory name is the name of your test suite. |
| 239 * * The status file uses the same name. | 239 * * The status file uses the same name. |
| 240 * * Test files are directly in that directory and end in "_tests.dart". | 240 * * Test files are directly in that directory and end in "_test.dart". |
| 241 * | 241 * |
| 242 * If you follow that convention, then you can construct one of these like: | 242 * If you follow that convention, then you can construct one of these like: |
| 243 * | 243 * |
| 244 * new StandardTestSuite.forDirectory(configuration, 'path/to/mytestsuite'); | 244 * new StandardTestSuite.forDirectory(configuration, 'path/to/mytestsuite'); |
| 245 * | 245 * |
| 246 * instead of having to create a custom [StandardTestSuite] subclass. In | 246 * instead of having to create a custom [StandardTestSuite] subclass. In |
| 247 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] | 247 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] |
| 248 * in test.dart, this will all be set up for you. | 248 * in test.dart, this will all be set up for you. |
| 249 */ | 249 */ |
| 250 factory StandardTestSuite.forDirectory( | 250 factory StandardTestSuite.forDirectory( |
| 251 Map configuration, String directory) { | 251 Map configuration, String directory) { |
| 252 final name = directory.substring(directory.lastIndexOf('/') + 1); | 252 final name = directory.substring(directory.lastIndexOf('/') + 1); |
| 253 | 253 |
| 254 return new StandardTestSuite(configuration, | 254 return new StandardTestSuite(configuration, |
| 255 name, directory, ['$directory/$name.status'], | 255 name, directory, ['$directory/$name.status'], |
| 256 (filename) => filename.endsWith('_tests.dart')); | 256 (filename) => filename.endsWith('_test.dart')); |
| 257 } | 257 } |
| 258 | 258 |
| 259 /** | 259 /** |
| 260 * The default implementation assumes a file is a test if | 260 * The default implementation assumes a file is a test if |
| 261 * it ends in "Test.dart". | 261 * it ends in "Test.dart". |
| 262 */ | 262 */ |
| 263 bool isTestFile(String filename) { | 263 bool isTestFile(String filename) { |
| 264 // Use the specified predicate, if provided. | 264 // Use the specified predicate, if provided. |
| 265 if (isTestFilePredicate != null) return isTestFilePredicate(filename); | 265 if (isTestFilePredicate != null) return isTestFilePredicate(filename); |
| 266 | 266 |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 * $noCrash tests are expected to be flaky but not crash | 1367 * $noCrash tests are expected to be flaky but not crash |
| 1368 * $pass tests are expected to pass | 1368 * $pass tests are expected to pass |
| 1369 * $failOk tests are expected to fail that we won't fix | 1369 * $failOk tests are expected to fail that we won't fix |
| 1370 * $fail tests are expected to fail that we should fix | 1370 * $fail tests are expected to fail that we should fix |
| 1371 * $crash tests are expected to crash that we should fix | 1371 * $crash tests are expected to crash that we should fix |
| 1372 * $timeout tests are allowed to timeout | 1372 * $timeout tests are allowed to timeout |
| 1373 """; | 1373 """; |
| 1374 print(report); | 1374 print(report); |
| 1375 } | 1375 } |
| 1376 } | 1376 } |
| OLD | NEW |