Commit 2a480eff authored by marja's avatar marja Committed by Commit bot

mjsunit: Fix the error message produced by assertInstanceof.

Used to be:

Failure: expected <foo> is not an instance of <Bar> but of < Baz>> found <undefined>

Should be:

Failure: <foo> is not an instance of <Bar> but of <Baz>

BUG=

Review-Url: https://codereview.chromium.org/2413153004
Cr-Commit-Position: refs/heads/master@{#40319}
parent 7899fcc5
...@@ -206,13 +206,16 @@ var assertMatches; ...@@ -206,13 +206,16 @@ var assertMatches;
function fail(expectedText, found, name_opt) { function fail(expectedText, found, name_opt) {
var message = "Fail" + "ure"; var message = "Fail" + "ure";
if (name_opt) { if (found) {
// Fix this when we ditch the old test runner. message += ": expected <" + expectedText +
message += " (" + name_opt + ")"; "> 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); throw new MjsUnitAssertionError(message);
} }
...@@ -396,7 +399,7 @@ var assertMatches; ...@@ -396,7 +399,7 @@ var assertMatches;
} }
fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" +
(type.name || type) + ">" + (type.name || type) + ">" +
(actualTypeName ? " but of < " + actualTypeName + ">" : "")); (actualTypeName ? " but of <" + actualTypeName + ">" : ""));
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment