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

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

Issue 12770017: pkg/unittest: config refactor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixed scheduled_test test 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/unittest.dart
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart
index 0d9a549b727c8603f17a8377dabdbed44cfe4637..329e20dc68b61be922a967f566b95ca5635b83e1 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -165,20 +165,23 @@ import 'mock.dart';
part 'src/config.dart';
part 'src/test_case.dart';
-/** [Configuration] used by the unittest library. */
-Configuration _config = null;
+Configuration _config;
-Configuration get config => _config;
+/** [Configuration] used by the unittest library. */
+Configuration get unittestConfiguration => _config;
Siggi Cherem (dart-lang) 2013/03/27 21:05:58 I wouldn't be too scared about external name colli
/**
- * Set the [Configuration] used by the unittest library. Returns any
- * previous configuration.
- * TODO: consider deprecating in favor of a setter now we have a getter.
+ * Sets the [Configuration] used by the unittest library.
+ *
+ * Throws a [StateError] if there is an existing, incompatible value.
*/
-Configuration configure(Configuration config) {
- Configuration _oldConfig = _config;
- _config = config;
- return _oldConfig;
+void set unittestConfiguration(Configuration value) {
+ if(!identical(_config, value)) {
+ if(_config != null) {
+ throw new StateError('unittestConfiguration has already been set');
+ }
+ _config = value;
+ }
}
void logMessage(String message) => _config.logMessage(message);
@@ -807,7 +810,7 @@ void ensureInitialized() {
_uncaughtErrorMessage = null;
if (_config == null) {
- _config = new Configuration();
+ unittestConfiguration = new Configuration();
}
_config.onInit();

Powered by Google App Engine
This is Rietveld 408576698