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

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

Issue 14021021: Unit test improvements. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698