mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-29 01:49:18 +08:00
use Object.is() in tests
This commit is contained in:
parent
f10ef299a6
commit
071a4cf986
@ -3,14 +3,8 @@ export function assert(actual, expected, message) {
|
||||
expected = true;
|
||||
|
||||
if (typeof actual === typeof expected) {
|
||||
if (actual === expected) {
|
||||
if (actual !== 0 || (1 / actual) === (1 / expected))
|
||||
return;
|
||||
}
|
||||
if (typeof actual === 'number') {
|
||||
if (isNaN(actual) && isNaN(expected))
|
||||
return;
|
||||
}
|
||||
if (Object.is(actual, expected))
|
||||
return;
|
||||
if (typeof actual === 'object') {
|
||||
if (actual !== null && expected !== null
|
||||
&& actual.constructor === expected.constructor
|
||||
|
@ -2,7 +2,7 @@ function assert(actual, expected, message) {
|
||||
if (arguments.length == 1)
|
||||
expected = true;
|
||||
|
||||
if (actual === expected)
|
||||
if (Object.is(actual, expected))
|
||||
return;
|
||||
|
||||
if (actual !== null && expected !== null
|
||||
|
@ -6,7 +6,7 @@ function assert(actual, expected, message) {
|
||||
if (arguments.length == 1)
|
||||
expected = true;
|
||||
|
||||
if (actual === expected)
|
||||
if (Object.is(actual, expected))
|
||||
return;
|
||||
|
||||
if (actual !== null && expected !== null
|
||||
|
Loading…
x
Reference in New Issue
Block a user