Chromium Code Reviews| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 int _actualCalls = 0; | 312 int _actualCalls = 0; |
| 313 int _testNum; | 313 int _testNum; |
| 314 TestCase _testCase; | 314 TestCase _testCase; |
| 315 Function _shouldCallBack; | 315 Function _shouldCallBack; |
| 316 Function _isDone; | 316 Function _isDone; |
| 317 static const _sentinel = const _Sentinel(); | 317 static const _sentinel = const _Sentinel(); |
| 318 | 318 |
| 319 _init(Function callback, Function shouldCallBack, Function isDone, | 319 _init(Function callback, Function shouldCallBack, Function isDone, |
| 320 [expectedCalls = 0]) { | 320 [expectedCalls = 0]) { |
| 321 ensureInitialized(); | 321 ensureInitialized(); |
| 322 if (!(_currentTest >= 0 && | |
| 323 _currentTest < _tests.length && | |
| 324 _tests[_currentTest] != null)) { | |
| 325 print("No valid test, did you forget to run your test inside a call " | |
|
Siggi Cherem (dart-lang)
2012/10/08 21:50:07
I'm surprised you need this... I'm cc'ing Graham f
gram
2012/10/08 22:03:30
We have an assert on the next line for the convers
justinfagnani
2012/10/08 22:12:48
I added an expectAsync to a test before wrapping i
justinfagnani
2012/10/08 22:12:48
The problem was that I wasn't getting the source o
Siggi Cherem (dart-lang)
2012/10/08 22:29:15
I see - I hope so. We can also turn the assert int
| |
| 326 "to test()?"); | |
| 327 } | |
| 322 assert(_currentTest >= 0 && | 328 assert(_currentTest >= 0 && |
| 323 _currentTest < _tests.length && | 329 _currentTest < _tests.length && |
| 324 _tests[_currentTest] != null); | 330 _tests[_currentTest] != null); |
| 325 _callback = callback; | 331 _callback = callback; |
| 326 _shouldCallBack = shouldCallBack; | 332 _shouldCallBack = shouldCallBack; |
| 327 _isDone = isDone; | 333 _isDone = isDone; |
| 328 _expectedCalls = expectedCalls; | 334 _expectedCalls = expectedCalls; |
| 329 _testNum = _currentTest; | 335 _testNum = _currentTest; |
| 330 _testCase = _tests[_currentTest]; | 336 _testCase = _tests[_currentTest]; |
| 331 if (expectedCalls > 0) { | 337 if (expectedCalls > 0) { |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 } | 877 } |
| 872 | 878 |
| 873 /** Enable a test by ID. */ | 879 /** Enable a test by ID. */ |
| 874 void enableTest(int testId) => _setTestEnabledState(testId, true); | 880 void enableTest(int testId) => _setTestEnabledState(testId, true); |
| 875 | 881 |
| 876 /** Disable a test by ID. */ | 882 /** Disable a test by ID. */ |
| 877 void disableTest(int testId) => _setTestEnabledState(testId, false); | 883 void disableTest(int testId) => _setTestEnabledState(testId, false); |
| 878 | 884 |
| 879 /** Signature for a test function. */ | 885 /** Signature for a test function. */ |
| 880 typedef void TestFunction(); | 886 typedef void TestFunction(); |
| OLD | NEW |