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

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: 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 2132a3e81f186c058fc61d8c46da2afcb0d6e1bb..f6abd35728c208d3e3cdf5f979ed7e48d2787774 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -156,6 +156,7 @@ library unittest;
import 'dart:async';
import 'dart:isolate';
import 'matcher.dart';
+import 'package:meta/meta.dart';
Siggi Cherem (dart-lang) 2013/03/24 17:20:09 unfortunately this library is used within the dart
Andrei Mouravski 2013/03/24 18:49:23 From what I remember, this wasn't working because
export 'matcher.dart';
// TODO(amouravski): We should not need to import mock here, but it's necessary
@@ -165,16 +166,27 @@ import 'mock.dart';
part 'src/config.dart';
part 'src/test_case.dart';
-/** [Configuration] used by the unittest library. */
-Configuration _config = null;
+Configuration _config;
+/** [Configuration] used by the unittest library. */
Configuration get config => _config;
/**
- * 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.
+ * Set the [Configuration] used by the unittest library.
+ *
+ * Throws an exception if a value has already been set.
+ */
+void set config(Configuration value) {
+ if(_config != null) {
+ throw 'config has already been set';
+ }
+ _config = value;
+}
+
+/**
+ * Use [config] instead.
*/
+@deprecated
Configuration configure(Configuration config) {
Configuration _oldConfig = _config;
_config = config;
@@ -814,7 +826,7 @@ void ensureInitialized() {
_uncaughtErrorMessage = null;
if (_config == null) {
- _config = new Configuration();
+ config = new Configuration();
Siggi Cherem (dart-lang) 2013/03/24 17:20:09 let's keep this with _config (you already checked
}
_config.onInit();

Powered by Google App Engine
This is Rietveld 408576698