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 19 matching lines...) Expand all Loading... |
30 * to wait for before the test completes. | 30 * to wait for before the test completes. |
31 */ | 31 */ |
32 int _callbackFunctionsOutstanding = 0; | 32 int _callbackFunctionsOutstanding = 0; |
33 | 33 |
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. */ | 44 /** Returns whether this test case passed. */ |
45 bool get passed => _result == PASS; | 45 bool get passed => _result == PASS; |
46 | 46 |
47 StackTrace _stackTrace; | 47 StackTrace _stackTrace; |
48 /** Stack trace associated with this test, or [null] if it succeeded. */ | 48 /** Stack trace associated with this test, or [:null:] if it succeeded. */ |
49 StackTrace get stackTrace => _stackTrace; | 49 StackTrace get stackTrace => _stackTrace; |
50 | 50 |
51 /** The group (or groups) under which this test is running. */ | 51 /** The group (or groups) under which this test is running. */ |
52 final String currentGroup; | 52 final String currentGroup; |
53 | 53 |
54 DateTime _startTime; | 54 DateTime _startTime; |
55 DateTime get startTime => _startTime; | 55 DateTime get startTime => _startTime; |
56 | 56 |
57 Duration _runningTime; | 57 Duration _runningTime; |
58 Duration get runningTime => _runningTime; | 58 Duration get runningTime => _runningTime; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 | 182 |
183 void _markCallbackComplete() { | 183 void _markCallbackComplete() { |
184 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { | 184 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { |
185 pass(); | 185 pass(); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 String toString() => _result != null ? "$description: $result" : description; | 189 String toString() => _result != null ? "$description: $result" : description; |
190 } | 190 } |
OLD | NEW |