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

--HG--
extra : rebase_source : 195eb6c4924627da64afb536e9b77858b498c5c6
This commit is contained in:
Jeff Walden 2015-07-02 21:19:02 -07:00
Родитель 9f7e9fa682
Коммит 04b22e3bcf
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -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) + "]";
}