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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Duration _runningTime; | 54 Duration _runningTime; |
55 Duration get runningTime => _runningTime; | 55 Duration get runningTime => _runningTime; |
56 | 56 |
57 bool enabled = true; | 57 bool enabled = true; |
58 | 58 |
59 bool _doneTeardown = false; | 59 bool _doneTeardown = false; |
60 | 60 |
61 Completer _testComplete; | 61 Completer _testComplete; |
62 | 62 |
63 TestCase._internal(this.id, this.description, this.testFunction) | 63 TestCase._internal(this.id, this.description, this.testFunction) |
64 : currentGroup = _currentGroup, | 64 : currentGroup = _currentContext.groupName, |
65 setUp = _testSetup, | 65 setUp = _currentContext.testSetup, |
66 tearDown = _testTeardown; | 66 tearDown = _currentContext.testTeardown; |
67 | 67 |
68 bool get isComplete => !enabled || result != null; | 68 bool get isComplete => !enabled || result != null; |
69 | 69 |
70 void _prepTest() { | 70 void _prepTest() { |
71 _config.onTestStart(this); | 71 _config.onTestStart(this); |
72 _startTime = new DateTime.now(); | 72 _startTime = new DateTime.now(); |
73 _runningTime = null; | 73 _runningTime = null; |
74 } | 74 } |
75 | 75 |
76 Future _runTest() { | 76 Future _runTest() { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void error(String messageText, [String stack = '']) { | 209 void error(String messageText, [String stack = '']) { |
210 _complete(ERROR, messageText, stack); | 210 _complete(ERROR, messageText, stack); |
211 } | 211 } |
212 | 212 |
213 void _markCallbackComplete() { | 213 void _markCallbackComplete() { |
214 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { | 214 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { |
215 pass(); | 215 pass(); |
216 } | 216 } |
217 } | 217 } |
218 } | 218 } |
OLD | NEW |