Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: pkg/unittest/lib/src/test_environment.dart

Issue 709903004: Enhance the Dart unittest library to support multiple invocations in the same application run. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more review feedback Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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.
nweiz 2014/11/13 19:34:27 The first sentence of a documentation comment shou
wibling 2014/11/14 10:09:48 Done.
8 /// This is used by the withTestEnvironment method to support multiple
nweiz 2014/11/13 19:34:27 withTestEnvironment -> [withTestEnironment].
wibling 2014/11/14 10:09:48 Done.
9 /// invocations of the unittest library with the same application
nweiz 2014/11/13 19:34:27 with -> within
wibling 2014/11/14 10:09:49 Done.
wibling 2014/11/14 10:09:49 Done.
10 /// instance.
11 class _TestEnvironment {
12 Configuration config = null;
nweiz 2014/11/13 19:34:27 "= null" is unnecessary here and elsewhere.
wibling 2014/11/14 10:09:48 Done.
wibling 2014/11/14 10:09:49 Done.
13
14 // We use a 'dummy' context for the top level to eliminate null
15 // checks when querying the context. This allows us to easily
16 // support top-level setUp/tearDown functions as well.
nweiz 2014/11/13 19:34:26 setUp -> [setUp], tearDown -> [tearDown].
wibling 2014/11/14 10:09:49 Done.
17 final rootContext = new _GroupContext();
18 _GroupContext currentContext;
19
20 /// Represents the index of the currently running test case
nweiz 2014/11/13 19:34:26 Use complete sentences here, including periods at
wibling 2014/11/14 10:09:48 Done.
21 /// == -1 implies the test system is not running
22 /// == [number of test cases] is a short-lived state flagging that the last
23 /// test has completed
24 int currentTestCaseIndex = -1;
25
26 /// Whether the framework is in an initialized state.
nweiz 2014/11/13 19:34:27 "is in an initialized state" -> "has been initiali
wibling 2014/11/14 10:09:49 Done.
27 bool initialized = false;
28
29 /// Time since we last gave non-sync code a chance to be scheduled.
nweiz 2014/11/13 19:34:27 "non-sync" -> "asynchronous"
wibling 2014/11/14 10:09:49 Done.
30 int lastBreath = new DateTime.now().millisecondsSinceEpoch;
31
32 /// The set of tests to run can be restricted by using [solo_test] and
33 /// [solo_group].
34 /// As groups can be nested we use a counter to keep track of the nest level
nweiz 2014/11/13 19:34:27 "nest level" -> "nesting level"
wibling 2014/11/14 10:09:49 Done.
35 /// of soloing, and a flag to tell if we have seen any solo tests.
36 int soloNestingLevel = 0;
37 bool soloTestSeen = false;
38
39 final List<TestCase> testCases;
nweiz 2014/11/13 19:34:27 Document this.
wibling 2014/11/14 10:09:48 Done.
40 final UnmodifiableListView<TestCase> testCasesRO;
nweiz 2014/11/13 19:34:27 We don't usually use suffixes like "RO". In genera
wibling 2014/11/14 10:09:48 Okay, I will change it back to my previous version
41
42 String uncaughtErrorMessage = null;
nweiz 2014/11/13 19:34:27 Document this.
wibling 2014/11/14 10:09:48 Done.
43
44 _TestEnvironment() : this._(new List<TestCase>());
45
46 _TestEnvironment._(List<TestCase> testCases)
nweiz 2014/11/13 19:34:27 These two constructors are confusing; what's the p
wibling 2014/11/14 10:09:48 The list of tests is not optional. The reason for
47 : this.testCases = testCases,
48 this.testCasesRO = new UnmodifiableListView(testCases) {
49 currentContext = rootContext;
50 }
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698