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

Side by Side Diff: pkg/unittest/lib/src/test_case.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: 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 58 bool _doneTeardown = false;
59 59
60 Completer _testComplete; 60 Completer _testComplete;
61 61
62 TestCase._internal(this.id, this.description, this._testFunction) 62 TestCase._internal(this.id, this.description, this._testFunction)
63 : currentGroup = _currentContext.fullName, 63 : currentGroup = _environment.currentContext.fullName,
64 _setUp = _currentContext.testSetup, 64 _setUp = _environment.currentContext.testSetup,
65 _tearDown = _currentContext.testTeardown; 65 _tearDown = _environment.currentContext.testTeardown;
66 66
67 bool get isComplete => !enabled || result != null; 67 bool get isComplete => !enabled || result != null;
68 68
69 Function _errorHandler(String stage) => (e, stack) { 69 Function _errorHandler(String stage) => (e, stack) {
70 if (stack == null && e is Error) { 70 if (stack == null && e is Error) {
71 stack = e.stackTrace; 71 stack = e.stackTrace;
72 } 72 }
73 if (result == null || result == PASS) { 73 if (result == null || result == PASS) {
74 if (e is TestFailure) { 74 if (e is TestFailure) {
75 _fail("$e", stack); 75 _fail("$e", stack);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 void _markCallbackComplete() { 184 void _markCallbackComplete() {
185 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { 185 if (--_callbackFunctionsOutstanding == 0 && !isComplete) {
186 _pass(); 186 _pass();
187 } 187 }
188 } 188 }
189 189
190 String toString() => _result != null ? "$description: $result" : description; 190 String toString() => _result != null ? "$description: $result" : description;
191 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698