Bug 1165533 - Use SameValue semantics in Mochitests' is() and similar methods. r=Ms2ger

--HG--
extra : rebase_source : 4f489223cb79ba15f8cdac151c1294eaac28d109
This commit is contained in:
Jeff Walden 2015-05-19 13:09:48 -07:00
Родитель fb6bc058ee
Коммит 64d2ef54cb
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -278,10 +278,11 @@ SimpleTest.ok = function (condition, name, diag) {
};
/**
* Roughly equivalent to ok(a===b, name)
* Roughly equivalent to ok(Object.is(a, b), name)
**/
SimpleTest.is = function (a, b, name) {
var pass = (a === b);
// Be lazy and use Object.is til we want to test a browser without it.
var pass = Object.is(a, b);
var diag = pass ? "" : "got " + repr(a) + ", expected " + repr(b)
SimpleTest.ok(pass, name, diag);
};
@ -293,7 +294,7 @@ SimpleTest.isfuzzy = function (a, b, epsilon, name) {
};
SimpleTest.isnot = function (a, b, name) {
var pass = (a !== b);
var pass = !Object.is(a, b);
var diag = pass ? "" : "didn't expect " + repr(a) + ", but got it";
SimpleTest.ok(pass, name, diag);
};
@ -411,14 +412,14 @@ SimpleTest.info = function(name, message) {
**/
SimpleTest.todo_is = function (a, b, name) {
var pass = (a === b);
var pass = Object.is(a, b);
var diag = pass ? repr(a) + " should equal " + repr(b)
: "got " + repr(a) + ", expected " + repr(b);
SimpleTest.todo(pass, name, diag);
};
SimpleTest.todo_isnot = function (a, b, name) {
var pass = (a !== b);
var pass = !Object.is(a, b);
var diag = pass ? repr(a) + " should not equal " + repr(b)
: "didn't expect " + repr(a) + ", but got it";
SimpleTest.todo(pass, name, diag);