Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 typedef void VoidFunction(); | 40 typedef void VoidFunction(); |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * A TestSuite represents a collection of tests. It creates a [TestCase] | 43 * A TestSuite represents a collection of tests. It creates a [TestCase] |
| 44 * object for each test to be run, and passes the test cases to a callback. | 44 * object for each test to be run, and passes the test cases to a callback. |
| 45 * | 45 * |
| 46 * Most TestSuites represent a directory or directory tree containing tests, | 46 * Most TestSuites represent a directory or directory tree containing tests, |
| 47 * and a status file containing the expected results when these tests are run. | 47 * and a status file containing the expected results when these tests are run. |
| 48 */ | 48 */ |
| 49 interface TestSuite { | 49 abstract class TestSuite { |
| 50 /** | 50 /** |
| 51 * Call the callback function onTest with a [TestCase] argument for each | 51 * Call the callback function onTest with a [TestCase] argument for each |
| 52 * test in the suite. When all tests have been processed, call [onDone]. | 52 * test in the suite. When all tests have been processed, call [onDone]. |
| 53 * | 53 * |
| 54 * The [testCache] argument provides a persistent store that can be used to | 54 * The [testCache] argument provides a persistent store that can be used to |
| 55 * cache information about the test suite, so that directories do not need | 55 * cache information about the test suite, so that directories do not need |
| 56 * to be listed each time. | 56 * to be listed each time. |
| 57 */ | 57 */ |
| 58 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]); | 58 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]); |
| 59 } | 59 } |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 return 'text/javascript'; | 825 return 'text/javascript'; |
| 826 default: | 826 default: |
| 827 Expect.fail('Non-web runtime, so no scriptType for: ' | 827 Expect.fail('Non-web runtime, so no scriptType for: ' |
| 828 '${configuration["compiler"]}'); | 828 '${configuration["compiler"]}'); |
| 829 return null; | 829 return null; |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 | 832 |
| 833 bool get hasRuntime { | 833 bool get hasRuntime { |
| 834 switch(configuration['runtime']) { | 834 switch(configuration['runtime']) { |
| 835 case null: | |
| 836 Expect.fail("configuration['runtime'] is not set"); | |
|
ricow1
2012/10/03 10:39:03
if we don't pass runtime in on the command line do
Mads Ager (google)
2012/10/03 10:44:10
At this point I'm just cleaning this up. 'runtime'
| |
| 837 case 'none': | 835 case 'none': |
| 838 return false; | 836 return false; |
| 839 default: | 837 default: |
| 840 return true; | 838 return true; |
| 841 } | 839 } |
| 842 } | 840 } |
| 843 | 841 |
| 844 String getHtmlName(String filename) { | 842 String getHtmlName(String filename) { |
| 845 var cleanFilename = filename.replaceAll('/', '_') | 843 var cleanFilename = filename.replaceAll('/', '_') |
| 846 .replaceAll(':', '_') | 844 .replaceAll(':', '_') |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1328 var prefix = ''; | 1326 var prefix = ''; |
| 1329 if (configuration['use_sdk']) { | 1327 if (configuration['use_sdk']) { |
| 1330 prefix = 'dart-sdk/bin/'; | 1328 prefix = 'dart-sdk/bin/'; |
| 1331 } | 1329 } |
| 1332 if (configuration['host_checked']) { | 1330 if (configuration['host_checked']) { |
| 1333 // The script dart2js_developer is not in the SDK. | 1331 // The script dart2js_developer is not in the SDK. |
| 1334 return 'dart2js_developer$suffix'; | 1332 return 'dart2js_developer$suffix'; |
| 1335 } else { | 1333 } else { |
| 1336 return '${prefix}dart2js$suffix'; | 1334 return '${prefix}dart2js$suffix'; |
| 1337 } | 1335 } |
| 1336 break; | |
| 1338 default: | 1337 default: |
| 1339 throw "Unknown executable for: ${configuration['compiler']}"; | 1338 throw "Unknown executable for: ${configuration['compiler']}"; |
| 1340 } | 1339 } |
| 1341 } | 1340 } |
| 1342 | 1341 |
| 1343 static String compilerName(Map configuration) { | 1342 static String compilerName(Map configuration) { |
| 1344 String suffix = executableSuffix(configuration['compiler']); | 1343 String suffix = executableSuffix(configuration['compiler']); |
| 1345 switch (configuration['compiler']) { | 1344 switch (configuration['compiler']) { |
| 1346 case 'dartc': | 1345 case 'dartc': |
| 1347 case 'dart2js': | 1346 case 'dart2js': |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1492 * $noCrash tests are expected to be flaky but not crash | 1491 * $noCrash tests are expected to be flaky but not crash |
| 1493 * $pass tests are expected to pass | 1492 * $pass tests are expected to pass |
| 1494 * $failOk tests are expected to fail that we won't fix | 1493 * $failOk tests are expected to fail that we won't fix |
| 1495 * $fail tests are expected to fail that we should fix | 1494 * $fail tests are expected to fail that we should fix |
| 1496 * $crash tests are expected to crash that we should fix | 1495 * $crash tests are expected to crash that we should fix |
| 1497 * $timeout tests are allowed to timeout | 1496 * $timeout tests are allowed to timeout |
| 1498 """; | 1497 """; |
| 1499 print(report); | 1498 print(report); |
| 1500 } | 1499 } |
| 1501 } | 1500 } |
| OLD | NEW |