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

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

Issue 13261006: pkg/unittest: cleanup to logMessage (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rename the log method on Configuration to look like the others Created 7 years, 9 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
Index: pkg/unittest/lib/src/config.dart
diff --git a/pkg/unittest/lib/src/config.dart b/pkg/unittest/lib/src/config.dart
index b557783464d9a40ae055e264b5669bf7c2c7bb9e..dc25771197127ee34ac9eff8154ff58b3e0c762e 100644
--- a/pkg/unittest/lib/src/config.dart
+++ b/pkg/unittest/lib/src/config.dart
@@ -21,13 +21,13 @@ class Configuration {
* Particularly useful in cases where we have parent/child configurations
* such as layout tests.
*/
- String get name => 'Configuration';
+ final String name = 'Configuration';
/**
* If true, then tests are started automatically (otherwise [runTests]
* must be called explicitly after the tests are set up.
*/
- bool get autoStart => true;
+ final bool autoStart = true;
/**
* Called as soon as the unittest framework becomes initialized. This is done
@@ -70,25 +70,10 @@ class Configuration {
}
/**
- * 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) {
- // 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);
- }
- }
-
- /**
* Handles the logging of messages by a test case. The default in
* this base configuration is to call print();
*/
- void logTestCaseMessage(TestCase testCase, String message) {
+ void onLogMessage(TestCase testCase, String message) {
kevmoo-old 2013/03/29 02:41:43 While we're breaking things, this should look more
print(message);
}
@@ -103,7 +88,7 @@ class Configuration {
void onSummary(int passed, int failed, int errors, List<TestCase> results,
String uncaughtError) {
// Print each test's result.
- for (final t in testCases) {
+ for (final t in results) {
var resultString = "${t.result}".toUpperCase();
print('$resultString: ${t.description}');
@@ -119,13 +104,11 @@ class Configuration {
// Show the summary.
print('');
- var success = false;
if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) {
print('No tests found.');
// This is considered a failure too.
} else if (failed == 0 && errors == 0 && uncaughtError == null) {
print('All $passed tests passed.');
- success = true;
Andrei Mouravski 2013/03/29 04:27:48 Why not instead change the signature and return a
kevmoo-old 2013/03/29 13:20:41 Because the caller is the unit test framework. It
} else {
if (uncaughtError != null) {
print('Top-level uncaught error: $uncaughtError');

Powered by Google App Engine
This is Rietveld 408576698