| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 * A simple function that tests [arg] and returns `true` or `false`. | 43 * A simple function that tests [arg] and returns `true` or `false`. |
| 44 */ | 44 */ |
| 45 typedef bool Predicate<T>(T arg); | 45 typedef bool Predicate<T>(T arg); |
| 46 | 46 |
| 47 typedef void CreateTest(Path filePath, | 47 typedef void CreateTest(Path filePath, |
| 48 bool hasCompileError, | 48 bool hasCompileError, |
| 49 bool hasRuntimeError, | 49 bool hasRuntimeError, |
| 50 {bool isNegativeIfChecked, | 50 {bool isNegativeIfChecked, |
| 51 bool hasCompileErrorIfChecked, | 51 bool hasCompileErrorIfChecked, |
| 52 bool hasStaticWarning, | 52 bool hasStaticWarning, |
| 53 Set<String> multitestOutcome, | |
| 54 String multitestKey, | 53 String multitestKey, |
| 55 Path originTestPath}); | 54 Path originTestPath}); |
| 56 | 55 |
| 57 typedef void VoidFunction(); | 56 typedef void VoidFunction(); |
| 58 | 57 |
| 59 /** | 58 /** |
| 60 * Calls [function] asynchronously. Returns a future that completes with the | 59 * Calls [function] asynchronously. Returns a future that completes with the |
| 61 * result of the function. If the function is `null`, returns a future that | 60 * result of the function. If the function is `null`, returns a future that |
| 62 * completes immediately with `null`. | 61 * completes immediately with `null`. |
| 63 */ | 62 */ |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 567 |
| 569 class TestInformation { | 568 class TestInformation { |
| 570 Path originTestPath; | 569 Path originTestPath; |
| 571 Path filePath; | 570 Path filePath; |
| 572 Map optionsFromFile; | 571 Map optionsFromFile; |
| 573 bool hasCompileError; | 572 bool hasCompileError; |
| 574 bool hasRuntimeError; | 573 bool hasRuntimeError; |
| 575 bool isNegativeIfChecked; | 574 bool isNegativeIfChecked; |
| 576 bool hasCompileErrorIfChecked; | 575 bool hasCompileErrorIfChecked; |
| 577 bool hasStaticWarning; | 576 bool hasStaticWarning; |
| 578 Set<String> multitestOutcome; | |
| 579 String multitestKey; | 577 String multitestKey; |
| 580 | 578 |
| 581 TestInformation(this.filePath, this.optionsFromFile, | 579 TestInformation(this.filePath, this.optionsFromFile, |
| 582 this.hasCompileError, this.hasRuntimeError, | 580 this.hasCompileError, this.hasRuntimeError, |
| 583 this.isNegativeIfChecked, this.hasCompileErrorIfChecked, | 581 this.isNegativeIfChecked, this.hasCompileErrorIfChecked, |
| 584 this.hasStaticWarning, | 582 this.hasStaticWarning, |
| 585 this.multitestOutcome, | |
| 586 {this.multitestKey, this.originTestPath}) { | 583 {this.multitestKey, this.originTestPath}) { |
| 587 assert(filePath.isAbsolute); | 584 assert(filePath.isAbsolute); |
| 588 if (originTestPath == null) originTestPath = filePath; | 585 if (originTestPath == null) originTestPath = filePath; |
| 589 } | 586 } |
| 590 } | 587 } |
| 591 | 588 |
| 592 /** | 589 /** |
| 593 * A standard [TestSuite] implementation that searches for tests in a | 590 * A standard [TestSuite] implementation that searches for tests in a |
| 594 * directory, and creates [TestCase]s that compile and/or run them. | 591 * directory, and creates [TestCase]s that compile and/or run them. |
| 595 */ | 592 */ |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 environmentOverrides)); | 1015 environmentOverrides)); |
| 1019 } | 1016 } |
| 1020 | 1017 |
| 1021 CreateTest makeTestCaseCreator(Map optionsFromFile) { | 1018 CreateTest makeTestCaseCreator(Map optionsFromFile) { |
| 1022 return (Path filePath, | 1019 return (Path filePath, |
| 1023 bool hasCompileError, | 1020 bool hasCompileError, |
| 1024 bool hasRuntimeError, | 1021 bool hasRuntimeError, |
| 1025 {bool isNegativeIfChecked: false, | 1022 {bool isNegativeIfChecked: false, |
| 1026 bool hasCompileErrorIfChecked: false, | 1023 bool hasCompileErrorIfChecked: false, |
| 1027 bool hasStaticWarning: false, | 1024 bool hasStaticWarning: false, |
| 1028 Set<String> multitestOutcome: null, | |
| 1029 String multitestKey, | 1025 String multitestKey, |
| 1030 Path originTestPath}) { | 1026 Path originTestPath}) { |
| 1031 // Cache the test information for each test case. | 1027 // Cache the test information for each test case. |
| 1032 var info = new TestInformation(filePath, | 1028 var info = new TestInformation(filePath, |
| 1033 optionsFromFile, | 1029 optionsFromFile, |
| 1034 hasCompileError, | 1030 hasCompileError, |
| 1035 hasRuntimeError, | 1031 hasRuntimeError, |
| 1036 isNegativeIfChecked, | 1032 isNegativeIfChecked, |
| 1037 hasCompileErrorIfChecked, | 1033 hasCompileErrorIfChecked, |
| 1038 hasStaticWarning, | 1034 hasStaticWarning, |
| 1039 multitestOutcome, | |
| 1040 multitestKey: multitestKey, | 1035 multitestKey: multitestKey, |
| 1041 originTestPath: originTestPath); | 1036 originTestPath: originTestPath); |
| 1042 cachedTests.add(info); | 1037 cachedTests.add(info); |
| 1043 enqueueTestCaseFromTestInformation(info); | 1038 enqueueTestCaseFromTestInformation(info); |
| 1044 }; | 1039 }; |
| 1045 } | 1040 } |
| 1046 | 1041 |
| 1047 /** | 1042 /** |
| 1048 * _createUrlPathFromFile takes a [file], which is either located in the dart | 1043 * _createUrlPathFromFile takes a [file], which is either located in the dart |
| 1049 * or in the build directory, and will return a String representing | 1044 * or in the build directory, and will return a String representing |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 * $pass tests are expected to pass | 2217 * $pass tests are expected to pass |
| 2223 * $failOk tests are expected to fail that we won't fix | 2218 * $failOk tests are expected to fail that we won't fix |
| 2224 * $fail tests are expected to fail that we should fix | 2219 * $fail tests are expected to fail that we should fix |
| 2225 * $crash tests are expected to crash that we should fix | 2220 * $crash tests are expected to crash that we should fix |
| 2226 * $timeout tests are allowed to timeout | 2221 * $timeout tests are allowed to timeout |
| 2227 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2222 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2228 """; | 2223 """; |
| 2229 print(report); | 2224 print(report); |
| 2230 } | 2225 } |
| 2231 } | 2226 } |
| OLD | NEW |