OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * A library for writing dart unit tests. | 6 * A library for writing dart unit tests. |
7 * | 7 * |
8 * To import this library, install the | 8 * To import this library, install the |
9 * [unittest package](http://pub.dartlang.org/packages/unittest) via the pub | 9 * [unittest package](http://pub.dartlang.org/packages/unittest) via the pub |
10 * package manager. See the [Getting Started](http://pub.dartlang.org/doc) | 10 * package manager. See the [Getting Started](http://pub.dartlang.org/doc) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 /** [Configuration] used by the unittest library. */ | 170 /** [Configuration] used by the unittest library. */ |
171 Configuration get unittestConfiguration => _config; | 171 Configuration get unittestConfiguration => _config; |
172 | 172 |
173 /** | 173 /** |
174 * Sets the [Configuration] used by the unittest library. | 174 * Sets the [Configuration] used by the unittest library. |
175 * | 175 * |
176 * Throws a [StateError] if there is an existing, incompatible value. | 176 * Throws a [StateError] if there is an existing, incompatible value. |
177 */ | 177 */ |
178 void set unittestConfiguration(Configuration value) { | 178 void set unittestConfiguration(Configuration value) { |
179 if(!identical(_config, value)) { | 179 _config = value; |
180 if(_config != null) { | |
181 throw new StateError('unittestConfiguration has already been set'); | |
182 } | |
183 _config = value; | |
184 } | |
185 } | 180 } |
186 | 181 |
187 void logMessage(String message) => _config.logMessage(message); | 182 void logMessage(String message) => _config.logMessage(message); |
188 | 183 |
189 /** | 184 /** |
190 * Description text of the current test group. If multiple groups are nested, | 185 * Description text of the current test group. If multiple groups are nested, |
191 * this will contain all of their text concatenated. | 186 * this will contain all of their text concatenated. |
192 */ | 187 */ |
193 String _currentGroup = ''; | 188 String _currentGroup = ''; |
194 | 189 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 } | 842 } |
848 | 843 |
849 /** Enable a test by ID. */ | 844 /** Enable a test by ID. */ |
850 void enableTest(int testId) => _setTestEnabledState(testId, true); | 845 void enableTest(int testId) => _setTestEnabledState(testId, true); |
851 | 846 |
852 /** Disable a test by ID. */ | 847 /** Disable a test by ID. */ |
853 void disableTest(int testId) => _setTestEnabledState(testId, false); | 848 void disableTest(int testId) => _setTestEnabledState(testId, false); |
854 | 849 |
855 /** Signature for a test function. */ | 850 /** Signature for a test function. */ |
856 typedef dynamic TestFunction(); | 851 typedef dynamic TestFunction(); |
OLD | NEW |