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

Unified Diff: pkg/unittest/lib/src/test_case.dart

Issue 19540015: Roll forward "Use package:stack_trace in unittest." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/unittest/lib/src/config.dart ('k') | pkg/unittest/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/test_case.dart
diff --git a/pkg/unittest/lib/src/test_case.dart b/pkg/unittest/lib/src/test_case.dart
index ad5bd6ad8a4b0644a3a9ebfcbb8ffca38f4e75e6..e28d21f91cbe77232ec33a8724bae1bef91adfc9 100644
--- a/pkg/unittest/lib/src/test_case.dart
+++ b/pkg/unittest/lib/src/test_case.dart
@@ -41,9 +41,9 @@ class TestCase {
*/
String get result => _result;
- String _stackTrace;
+ Trace _stackTrace;
/** Stack trace associated with this test, or [null] if it succeeded. */
- String get stackTrace => _stackTrace;
+ Trace get stackTrace => _stackTrace;
/** The group (or groups) under which this test is running. */
final String currentGroup;
@@ -69,7 +69,6 @@ class TestCase {
Function _errorHandler(String stage) => (e) {
var stack = getAttachedStackTrace(e);
- stack = (stack == null) ? '' : '$stack';
if (result == null || result == PASS) {
if (e is TestFailure) {
fail("$e", stack);
@@ -122,9 +121,9 @@ class TestCase {
// Set the results, notify the config, and return true if this
// is the first time the result is being set.
- void _setResult(String testResult, String messageText, String stack) {
+ void _setResult(String testResult, String messageText, stack) {
_message = messageText;
- _stackTrace = _formatStack(stack);
+ _stackTrace = _getTrace(stack);
if (result == null) {
_result = testResult;
_config.onTestResult(this);
@@ -134,9 +133,7 @@ class TestCase {
}
}
- void _complete(String testResult,
- [String messageText = '',
- String stack = '']) {
+ void _complete(String testResult, [String messageText = '', stack]) {
if (runningTime == null) {
// The startTime can be `null` if an error happened during setup. In this
// case we simply report a running time of 0.
@@ -158,8 +155,7 @@ class TestCase {
_complete(PASS);
}
- void fail(String messageText, [String stack = '']) {
- assert(stack != null);
+ void fail(String messageText, [stack]) {
if (result != null) {
String newMessage = (result == PASS)
? 'Test failed after initially passing: $messageText'
@@ -171,8 +167,7 @@ class TestCase {
}
}
- void error(String messageText, [String stack = '']) {
- assert(stack != null);
+ void error(String messageText, [stack]) {
_complete(ERROR, messageText, stack);
}
« no previous file with comments | « pkg/unittest/lib/src/config.dart ('k') | pkg/unittest/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698