Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: pkg/unittest/lib/src/config.dart

Issue 12366004: When we have excess callbacks, throw instead of calling error() so that we (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/unittest/lib/src/test_case.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | pkg/unittest/lib/src/test_case.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698