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 /// Represents the state for an individual unit test. | 7 /// Represents the state for an individual unit test. |
8 /// | 8 /// |
9 /// Create by calling [test] or [solo_test]. | 9 /// Create by calling [test] or [solo_test]. |
10 class TestCase { | 10 class TestCase { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DateTime _startTime; | 48 DateTime _startTime; |
49 DateTime get startTime => _startTime; | 49 DateTime get startTime => _startTime; |
50 | 50 |
51 Duration _runningTime; | 51 Duration _runningTime; |
52 Duration get runningTime => _runningTime; | 52 Duration get runningTime => _runningTime; |
53 | 53 |
54 bool _enabled = true; | 54 bool _enabled = true; |
55 | 55 |
56 bool get enabled => _enabled; | 56 bool get enabled => _enabled; |
57 | 57 |
58 bool _doneTeardown = false; | |
59 | |
60 Completer _testComplete; | 58 Completer _testComplete; |
61 | 59 |
62 TestCase._internal(this.id, this.description, this._testFunction) | 60 TestCase._internal(this.id, this.description, this._testFunction) |
63 : currentGroup = _environment.currentContext.fullName, | 61 : currentGroup = _environment.currentContext.fullName, |
64 _setUp = _environment.currentContext.testSetup, | 62 _setUp = _environment.currentContext.testSetup, |
65 _tearDown = _environment.currentContext.testTeardown; | 63 _tearDown = _environment.currentContext.testTeardown; |
66 | 64 |
67 bool get isComplete => !enabled || result != null; | 65 bool get isComplete => !enabled || result != null; |
68 | 66 |
69 Function _errorHandler(String stage) => (e, stack) { | 67 Function _errorHandler(String stage) => (e, stack) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 181 } |
184 | 182 |
185 void _markCallbackComplete() { | 183 void _markCallbackComplete() { |
186 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { | 184 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { |
187 _pass(); | 185 _pass(); |
188 } | 186 } |
189 } | 187 } |
190 | 188 |
191 String toString() => _result != null ? "$description: $result" : description; | 189 String toString() => _result != null ? "$description: $result" : description; |
192 } | 190 } |
OLD | NEW |