| Index: pkg/unittest/lib/src/config.dart
|
| ===================================================================
|
| --- pkg/unittest/lib/src/config.dart (revision 19267)
|
| +++ pkg/unittest/lib/src/config.dart (working copy)
|
| @@ -15,10 +15,7 @@
|
| // The VM won't shut down if a receive port is open. Use this to make sure
|
| // we correctly wait for asynchronous tests.
|
| ReceivePort _receivePort;
|
| - TestCase _currentTestCase;
|
|
|
| - TestCase get currentTestCase => _currentTestCase;
|
| -
|
| /**
|
| * Subclasses can override this with something useful for diagnostics.
|
| * Particularly useful in cases where we have parent/child configurations
|
| @@ -53,32 +50,34 @@
|
| */
|
| void onTestStart(TestCase testCase) {
|
| assert(testCase != null);
|
| - assert(_currentTestCase == null);
|
| - _currentTestCase = testCase;
|
| }
|
|
|
| /**
|
| - * Called when each test is completed. Useful to show intermediate progress on
|
| - * a test suite.
|
| + * Called when each test is first completed. Useful to show intermediate
|
| + * progress on a test suite.
|
| */
|
| void onTestResult(TestCase testCase) {
|
| assert(testCase != null);
|
| - assert(_currentTestCase == null || _currentTestCase == testCase);
|
| - _currentTestCase = null;
|
| }
|
|
|
| /**
|
| + * Called when an already completed test changes state; for example a test
|
| + * that was marked as passing may later be marked as being in error because
|
| + * it still had callbacks being invoked.
|
| + */
|
| + void onTestResultChanged(TestCase testCase) {
|
| + assert(testCase != null);
|
| + }
|
| +
|
| + /**
|
| * Can be called by tests to log status. Tests should use this
|
| * instead of print. Subclasses should not override this; they
|
| * should instead override logMessage which is passed the test case.
|
| */
|
| void logMessage(String message) {
|
| - if (currentTestCase == null || _currentTest >= _tests.length ||
|
| - currentTestCase.id != _tests[_currentTest].id) {
|
| - // Before or after tests run, or with a mismatch between what the
|
| - // config and the test harness think is the current test. In this
|
| - // case we pass null for the test case reference and let the config
|
| - // decide what to do with this.
|
| + if (currentTestCase == null) {
|
| + // Before or after tests run. In this case we pass null for the test
|
| + // case reference and let the config decide what to do with this.
|
| logTestCaseMessage(null, message);
|
| } else {
|
| logTestCaseMessage(currentTestCase, message);
|
|
|