Index: test/mjsunit/mjsunit.js |
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js |
index 86052ee0a108fb377ad97f4cde220d26afe82bb2..d56a22701af1af56d119382c23ab6b734b9b4f02 100644 |
--- a/test/mjsunit/mjsunit.js |
+++ b/test/mjsunit/mjsunit.js |
@@ -206,13 +206,16 @@ var assertMatches; |
function fail(expectedText, found, name_opt) { |
var message = "Fail" + "ure"; |
- if (name_opt) { |
- // Fix this when we ditch the old test runner. |
- message += " (" + name_opt + ")"; |
+ if (found) { |
+ message += ": expected <" + expectedText + |
+ "> found <" + PrettyPrint(found) + ">"; |
+ if (name_opt) { |
+ // Fix this when we ditch the old test runner. |
+ message += " (" + name_opt + ")"; |
+ } |
+ } else { |
+ message += ": " + expectedText; |
} |
- |
- message += ": expected <" + expectedText + |
- "> found <" + PrettyPrint(found) + ">"; |
throw new MjsUnitAssertionError(message); |
} |
@@ -396,7 +399,7 @@ var assertMatches; |
} |
fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + |
(type.name || type) + ">" + |
- (actualTypeName ? " but of < " + actualTypeName + ">" : "")); |
+ (actualTypeName ? " but of <" + actualTypeName + ">" : "")); |
} |
}; |