OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 part of unittest; | |
6 | |
7 /// Class for encapsulating test environment state. | |
8 /// | |
9 /// This is used by the [withTestEnvironment] method to support multiple | |
10 /// invocations of the unittest library within the same application | |
11 /// instance. | |
12 class _TestEnvironment { | |
13 Configuration config; | |
14 | |
15 // We use a 'dummy' context for the top level to eliminate null | |
16 // checks when querying the context. This allows us to easily | |
17 // support top-level [setUp]/[tearDown] functions as well. | |
18 final rootContext = new _GroupContext(); | |
19 _GroupContext currentContext; | |
20 | |
21 /// The [currentTestCaseIndex] represents the index of the currently running | |
22 /// test case. | |
23 /// | |
24 /// == -1 implies the test system is not running. | |
25 /// == [number of test cases] is a short-lived state flagging that the last | |
26 /// test has completed. | |
nweiz
2014/11/17 23:02:55
Don't start sentences with "=="; use something lik
wibling
2014/11/18 10:16:49
Sure. I have fixed it.
| |
27 int currentTestCaseIndex = -1; | |
28 | |
29 /// The [initialized] variable specifies whether the framework | |
30 /// has been initialized. | |
31 bool initialized = false; | |
32 | |
33 /// The time since we last gave asynchronous code a chance to be scheduled. | |
34 int lastBreath = new DateTime.now().millisecondsSinceEpoch; | |
35 | |
36 /// The set of tests to run can be restricted by using [solo_test] and | |
37 /// [solo_group]. | |
38 /// | |
39 /// As groups can be nested we use a counter to keep track of the nesting | |
40 /// level of soloing, and a flag to tell if we have seen any solo tests. | |
41 int soloNestingLevel = 0; | |
42 bool soloTestSeen = false; | |
43 | |
44 /// The list of test cases to run. | |
45 final List<TestCase> testCases = new List<TestCase>(); | |
nweiz
2014/11/17 23:02:55
There's no need to type annotate this, since the t
wibling
2014/11/18 10:16:49
I am getting mixed feedback here. As far as I have
nweiz
2014/11/19 21:40:39
The code in the repo isn't entirely consistent, bu
| |
46 | |
47 /// The [uncaughtErrorMessage] holds the error messages that are printed | |
48 /// in the test summary. | |
49 String uncaughtErrorMessage; | |
50 | |
51 _TestEnvironment() { | |
52 currentContext = rootContext; | |
53 } | |
54 } | |
OLD | NEW |