| Index: pkg/unittest/lib/src/test_environment.dart
|
| diff --git a/pkg/unittest/lib/src/test_environment.dart b/pkg/unittest/lib/src/test_environment.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..01831b4474bfbdac542e1767fce62abb405c1882
|
| --- /dev/null
|
| +++ b/pkg/unittest/lib/src/test_environment.dart
|
| @@ -0,0 +1,46 @@
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +part of unittest;
|
| +
|
| +/// Class for encapsulating test environment state.
|
| +/// This is used by the withTestEnvironment method to support multiple
|
| +/// invocations of the unittest library with the same application
|
| +/// instance.
|
| +class _TestEnvironment {
|
| + Configuration config = null;
|
| +
|
| + // We use a 'dummy' context for the top level to eliminate null
|
| + // checks when querying the context. This allows us to easily
|
| + // support top-level setUp/tearDown functions as well.
|
| + final rootContext = new _GroupContext();
|
| + _GroupContext currentContext;
|
| +
|
| + /// Represents the index of the currently running test case
|
| + /// == -1 implies the test system is not running
|
| + /// == [number of test cases] is a short-lived state flagging that the last
|
| + /// test has completed
|
| + int currentTestCaseIndex = -1;
|
| +
|
| + /// Whether the framework is in an initialized state.
|
| + bool initialized = false;
|
| +
|
| + /// Time since we last gave non-sync code a chance to be scheduled.
|
| + int lastBreath = new DateTime.now().millisecondsSinceEpoch;
|
| +
|
| + /// The set of tests to run can be restricted by using [solo_test] and
|
| + /// [solo_group].
|
| + /// As groups can be nested we use a counter to keep track of the nest level
|
| + /// of soloing, and a flag to tell if we have seen any solo tests.
|
| + int soloNestingLevel = 0;
|
| + bool soloTestSeen = false;
|
| +
|
| + final List<TestCase> testCases = new List<TestCase>();
|
| +
|
| + String uncaughtErrorMessage = null;
|
| +
|
| + _TestEnvironment() {
|
| + currentContext = rootContext;
|
| + }
|
| +}
|
|
|