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

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

Issue 22859009: Changes to how we handle fancy stacks: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 months 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 /** 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 23 matching lines...) Expand all
34 String _message = ''; 34 String _message = '';
35 /** Error or failure message. */ 35 /** Error or failure message. */
36 String get message => _message; 36 String get message => _message;
37 37
38 String _result; 38 String _result;
39 /** 39 /**
40 * One of [PASS], [FAIL], [ERROR], or [null] if the test hasn't run yet. 40 * One of [PASS], [FAIL], [ERROR], or [null] if the test hasn't run yet.
41 */ 41 */
42 String get result => _result; 42 String get result => _result;
43 43
44 Trace _stackTrace; 44 String _stackTrace;
45 /** Stack trace associated with this test, or [null] if it succeeded. */ 45 /** Stack trace associated with this test, or [null] if it succeeded. */
46 Trace get stackTrace => _stackTrace; 46 get stackTrace => _stackTrace;
nweiz 2013/08/15 23:03:25 The getter should also be typed. Now there's no w
gram 2013/08/16 16:56:45 I'm changing it to StackTrace; I wasn't aware that
47 47
48 /** The group (or groups) under which this test is running. */ 48 /** The group (or groups) under which this test is running. */
49 final String currentGroup; 49 final String currentGroup;
50 50
51 DateTime _startTime; 51 DateTime _startTime;
52 DateTime get startTime => _startTime; 52 DateTime get startTime => _startTime;
53 53
54 Duration _runningTime; 54 Duration _runningTime;
55 Duration get runningTime => _runningTime; 55 Duration get runningTime => _runningTime;
56 56
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }).catchError(_errorHandler('Teardown')); 123 }).catchError(_errorHandler('Teardown'));
124 } else if (tearDown != null) { 124 } else if (tearDown != null) {
125 return tearDown(); 125 return tearDown();
126 } 126 }
127 }) 127 })
128 .catchError(_errorHandler('Teardown')); 128 .catchError(_errorHandler('Teardown'));
129 } 129 }
130 130
131 // Set the results, notify the config, and return true if this 131 // Set the results, notify the config, and return true if this
132 // is the first time the result is being set. 132 // is the first time the result is being set.
133 void _setResult(String testResult, String messageText, stack) { 133 void _setResult(String testResult, String messageText, stack) {
nweiz 2013/08/15 23:03:25 [stack] here should be typed as StackTrace.
gram 2013/08/16 16:56:45 Done.
134 _message = messageText; 134 _message = messageText;
135 _stackTrace = _getTrace(stack); 135 var trace = _getTrace(stack);
136 if (trace == null) trace = stack;
137 _stackTrace = (trace == null) ? null : trace.toString();
136 if (result == null) { 138 if (result == null) {
137 _result = testResult; 139 _result = testResult;
138 _config.onTestResult(this); 140 _config.onTestResult(this);
139 } else { 141 } else {
140 _result = testResult; 142 _result = testResult;
141 _config.onTestResultChanged(this); 143 _config.onTestResultChanged(this);
142 } 144 }
143 } 145 }
144 146
145 void _complete(String testResult, [String messageText = '', stack]) { 147 void _complete(String testResult, [String messageText = '', stack]) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void error(String messageText, [stack]) { 181 void error(String messageText, [stack]) {
180 _complete(ERROR, messageText, stack); 182 _complete(ERROR, messageText, stack);
181 } 183 }
182 184
183 void _markCallbackComplete() { 185 void _markCallbackComplete() {
184 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { 186 if (--_callbackFunctionsOutstanding == 0 && !isComplete) {
185 pass(); 187 pass();
186 } 188 }
187 } 189 }
188 } 190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698