mirror of https://github.com/tc39/test262.git
commit
3b49ec5108
|
@ -0,0 +1,42 @@
|
|||
function assert(mustBeTrue, message) {
|
||||
if (mustBeTrue === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message === undefined) {
|
||||
message = 'Expected true but got ' + String(truthy);
|
||||
}
|
||||
$ERROR(message);
|
||||
}
|
||||
|
||||
assert._isSameValue = function (a, b) {
|
||||
if (a === b) {
|
||||
// Handle +/-0 vs. -/+0
|
||||
return a !== 0 || 1 / a === 1 / b;
|
||||
}
|
||||
|
||||
// Handle NaN vs. NaN
|
||||
return a !== a && b !== b;
|
||||
};
|
||||
|
||||
assert.sameValue = function (actual, expected, message) {
|
||||
if (assert._isSameValue(actual, expected)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message === undefined) {
|
||||
message = 'Expected SameValue(' + String(actual) + ', ' + String(expected) + ') to be true';
|
||||
}
|
||||
$ERROR(message);
|
||||
};
|
||||
|
||||
assert.notSameValue = function (actual, unexpected, message) {
|
||||
if (!assert._isSameValue(actual, unexpected)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message === undefined) {
|
||||
message = 'Expected SameValue(' + String(actual) + ', ' + String(unexpected) + ') to be false';
|
||||
}
|
||||
$ERROR(message);
|
||||
};
|
|
@ -8,10 +8,6 @@ description: thisArg should be bound to this if provided
|
|||
var globalThis = this;
|
||||
|
||||
[1].find(function () {
|
||||
if (this !== Array) {
|
||||
$ERROR('#1: this !== Array');
|
||||
}
|
||||
if (this === globalThis) {
|
||||
$ERROR('#2: this === globalThis. Should be Array');
|
||||
}
|
||||
assert.sameValue(this, Array, 'this should equal Array');
|
||||
assert.notSameValue(this, globalThis, 'this should not equal globalThis');
|
||||
}, Array);
|
||||
|
|
Loading…
Reference in New Issue