| 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, specify the relative path to | 8 * To import this library, specify the relative path to |
| 9 * pkg/unittest/unittest.dart. | 9 * pkg/unittest/unittest.dart. |
| 10 * | 10 * |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 int _expectedCalls; | 310 int _expectedCalls; |
| 311 int _actualCalls = 0; | 311 int _actualCalls = 0; |
| 312 int _testNum; | 312 int _testNum; |
| 313 TestCase _testCase; | 313 TestCase _testCase; |
| 314 Function _shouldCallBack; | 314 Function _shouldCallBack; |
| 315 Function _isDone; | 315 Function _isDone; |
| 316 | 316 |
| 317 _init(Function callback, Function shouldCallBack, Function isDone, | 317 _init(Function callback, Function shouldCallBack, Function isDone, |
| 318 [expectedCalls = 0]) { | 318 [expectedCalls = 0]) { |
| 319 ensureInitialized(); | 319 ensureInitialized(); |
| 320 assert(_currentTest < _tests.length); | 320 assert(_currentTest >= 0 && |
| 321 _currentTest < _tests.length && |
| 322 _tests[_currentTest] != null); |
| 321 _callback = callback; | 323 _callback = callback; |
| 322 _shouldCallBack = shouldCallBack; | 324 _shouldCallBack = shouldCallBack; |
| 323 _isDone = isDone; | 325 _isDone = isDone; |
| 324 _expectedCalls = expectedCalls; | 326 _expectedCalls = expectedCalls; |
| 325 _testNum = _currentTest; | 327 _testNum = _currentTest; |
| 326 _testCase = _tests[_currentTest]; | 328 _testCase = _tests[_currentTest]; |
| 327 if (expectedCalls > 0) { | 329 if (expectedCalls > 0) { |
| 328 _testCase.callbackFunctionsOutstanding++; | 330 _testCase.callbackFunctionsOutstanding++; |
| 329 } | 331 } |
| 330 } | 332 } |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 } | 869 } |
| 868 | 870 |
| 869 /** Enable a test by ID. */ | 871 /** Enable a test by ID. */ |
| 870 void enableTest(int testId) => _setTestEnabledState(testId, true); | 872 void enableTest(int testId) => _setTestEnabledState(testId, true); |
| 871 | 873 |
| 872 /** Disable a test by ID. */ | 874 /** Disable a test by ID. */ |
| 873 void disableTest(int testId) => _setTestEnabledState(testId, false); | 875 void disableTest(int testId) => _setTestEnabledState(testId, false); |
| 874 | 876 |
| 875 /** Signature for a test function. */ | 877 /** Signature for a test function. */ |
| 876 typedef void TestFunction(); | 878 typedef void TestFunction(); |
| OLD | NEW |