| 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 part of unittest; | 5 part of unittest; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Represents the state for an individual unit test. | 8 * Represents the state for an individual unit test. |
| 9 * | 9 * |
| 10 * Create by calling [test] or [solo_test]. | 10 * Create by calling [test] or [solo_test]. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 String _message = ''; | 34 String _message = ''; |
| 35 /** Error or failure message. */ | 35 /** Error or failure message. */ |
| 36 String get message => _message; | 36 String get message => _message; |
| 37 | 37 |
| 38 String _result; | 38 String _result; |
| 39 /** | 39 /** |
| 40 * One of [PASS], [FAIL], [ERROR], or [null] if the test hasn't run yet. | 40 * One of [PASS], [FAIL], [ERROR], or [null] if the test hasn't run yet. |
| 41 */ | 41 */ |
| 42 String get result => _result; | 42 String get result => _result; |
| 43 | 43 |
| 44 /** Returns whether this test case passed. */ |
| 45 bool get passed => _result == PASS; |
| 46 |
| 44 StackTrace _stackTrace; | 47 StackTrace _stackTrace; |
| 45 /** Stack trace associated with this test, or [null] if it succeeded. */ | 48 /** Stack trace associated with this test, or [null] if it succeeded. */ |
| 46 StackTrace get stackTrace => _stackTrace; | 49 StackTrace get stackTrace => _stackTrace; |
| 47 | 50 |
| 48 /** The group (or groups) under which this test is running. */ | 51 /** The group (or groups) under which this test is running. */ |
| 49 final String currentGroup; | 52 final String currentGroup; |
| 50 | 53 |
| 51 DateTime _startTime; | 54 DateTime _startTime; |
| 52 DateTime get startTime => _startTime; | 55 DateTime get startTime => _startTime; |
| 53 | 56 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 183 |
| 181 void error(String messageText, [StackTrace stack]) { | 184 void error(String messageText, [StackTrace stack]) { |
| 182 _complete(ERROR, messageText, stack); | 185 _complete(ERROR, messageText, stack); |
| 183 } | 186 } |
| 184 | 187 |
| 185 void _markCallbackComplete() { | 188 void _markCallbackComplete() { |
| 186 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { | 189 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { |
| 187 pass(); | 190 pass(); |
| 188 } | 191 } |
| 189 } | 192 } |
| 193 |
| 194 String toString() => _result != null ? "$description: $result" : description; |
| 190 } | 195 } |
| OLD | NEW |