Index: pkg/unittest/lib/src/test_case.dart |
=================================================================== |
--- pkg/unittest/lib/src/test_case.dart (revision 22128) |
+++ pkg/unittest/lib/src/test_case.dart (working copy) |
@@ -122,6 +122,7 @@ |
// seems to be the more conservative approach, because |
// unittest will not stop at a test failure. |
var stack = getAttachedStackTrace(e); |
+ if (stack == null) stack = ''; |
error("$description: Test setup failed: $e", "$stack"); |
}); |
} else { |
@@ -148,7 +149,7 @@ |
// is the first time the result is being set. |
void _setResult(String testResult, String messageText, String stack) { |
_message = messageText; |
- _stackTrace = stack; |
+ _stackTrace = _formatStack(stack); |
if (result == null) { |
_result = testResult; |
_config.onTestResult(this); |
@@ -199,6 +200,7 @@ |
} |
void fail(String messageText, [String stack = '']) { |
+ assert(stack != null); |
if (result != null) { |
String newMessage = (result == PASS) |
? 'Test failed after initially passing: $messageText' |
@@ -211,6 +213,7 @@ |
} |
void error(String messageText, [String stack = '']) { |
+ assert(stack != null); |
_complete(ERROR, messageText, stack); |
} |