Bug 1165533 - Make Mochitest's repr() functionality better distinguish values: include an explicit sign in zero representations, and escape and quote strings to distinguish them from their contents. r=Ms2ger

This commit is contained in:
Jeff Walden 2015-07-02 21:19:02 -07:00
parent 96c2588dae
commit c12fcd1e60

View File

@ -86,8 +86,15 @@ if (typeof(repr) == 'undefined') {
}
} catch (e) {
}
var ostring;
try {
var ostring = (o + "");
if (o === 0) {
ostring = (1 / o > 0) ? "+0" : "-0";
} else if (typeof o === "string") {
ostring = JSON.stringify(o);
} else {
ostring = (o + "");
}
} catch (e) {
return "[" + typeof(o) + "]";
}