| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 * A library for writing dart unit tests. | 6 * A library for writing dart unit tests. |
| 7 * | 7 * |
| 8 * To import this library, use the pub package manager. | 8 * To import this library, use the pub package manager. |
| 9 * Create a pubspec.yaml file in your project and add | 9 * Create a pubspec.yaml file in your project and add |
| 10 * a dependency on unittest with the following lines: | 10 * a dependency on unittest with the following lines: |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 void _handleCallbackFunctionComplete(testNum) { | 649 void _handleCallbackFunctionComplete(testNum) { |
| 650 // TODO (gram): we defer this to give the nextBatch recursive | 650 // TODO (gram): we defer this to give the nextBatch recursive |
| 651 // stack a chance to unwind. This is a temporary hack but | 651 // stack a chance to unwind. This is a temporary hack but |
| 652 // really a bunch of code here needs to be fixed. We have a | 652 // really a bunch of code here needs to be fixed. We have a |
| 653 // single array that is being iterated through by nextBatch(), | 653 // single array that is being iterated through by nextBatch(), |
| 654 // which is recursively invoked in the case of async tests that | 654 // which is recursively invoked in the case of async tests that |
| 655 // run synchronously. Bad things can then happen. | 655 // run synchronously. Bad things can then happen. |
| 656 _defer(() { | 656 _defer(() { |
| 657 if (_currentTest != testNum) { | 657 if (_currentTest != testNum) { |
| 658 if (_tests[testNum].result == PASS) { | 658 if (_tests[testNum].result == PASS) { |
| 659 _tests[testNum].error("Unexpected extra callbacks"); | 659 _tests[testNum].error("Unexpected extra callbacks", ''); |
| 660 } | 660 } |
| 661 return; // Extraneous callback. | 661 return; // Extraneous callback. |
| 662 } | 662 } |
| 663 if (_currentTest < _tests.length) { | 663 if (_currentTest < _tests.length) { |
| 664 final testCase = _tests[_currentTest]; | 664 final testCase = _tests[_currentTest]; |
| 665 --testCase.callbackFunctionsOutstanding; | 665 --testCase.callbackFunctionsOutstanding; |
| 666 if (testCase.callbackFunctionsOutstanding < 0) { | 666 if (testCase.callbackFunctionsOutstanding < 0) { |
| 667 // TODO(gram): Check: Can this even happen? | 667 // TODO(gram): Check: Can this even happen? |
| 668 testCase.error( | 668 testCase.error( |
| 669 'More calls to _handleCallbackFunctionComplete() than expected.', | 669 'More calls to _handleCallbackFunctionComplete() than expected.', |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 903 } |
| 904 | 904 |
| 905 /** Enable a test by ID. */ | 905 /** Enable a test by ID. */ |
| 906 void enableTest(int testId) => _setTestEnabledState(testId, true); | 906 void enableTest(int testId) => _setTestEnabledState(testId, true); |
| 907 | 907 |
| 908 /** Disable a test by ID. */ | 908 /** Disable a test by ID. */ |
| 909 void disableTest(int testId) => _setTestEnabledState(testId, false); | 909 void disableTest(int testId) => _setTestEnabledState(testId, false); |
| 910 | 910 |
| 911 /** Signature for a test function. */ | 911 /** Signature for a test function. */ |
| 912 typedef void TestFunction(); | 912 typedef void TestFunction(); |
| OLD | NEW |