mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:58:14 +00:00
LibJS: Handle Infinity in Value::to_number()
This commit is contained in:
parent
477bacddad
commit
f226746394
3 changed files with 17 additions and 0 deletions
|
@ -10,6 +10,12 @@ try {
|
|||
assert(new Number(null).valueOf() === 0);
|
||||
assert(Number(true) === 1);
|
||||
assert(new Number(true).valueOf() === 1);
|
||||
assert(Number("Infinity") === Infinity);
|
||||
assert(new Number("Infinity").valueOf() === Infinity);
|
||||
assert(Number("+Infinity") === Infinity);
|
||||
assert(new Number("+Infinity").valueOf() === Infinity);
|
||||
assert(Number("-Infinity") === -Infinity);
|
||||
assert(new Number("-Infinity").valueOf() === -Infinity);
|
||||
assert(isNaN(Number(undefined)));
|
||||
assert(isNaN(new Number(undefined).valueOf()));
|
||||
assert(isNaN(Number({})));
|
||||
|
|
|
@ -22,6 +22,12 @@ try {
|
|||
// FIXME: returns NaN
|
||||
// assert(+"1.23" === 1.23)
|
||||
// assert(-"1.23" === -1.23)
|
||||
assert(+"Infinity" === Infinity);
|
||||
assert(+"+Infinity" === Infinity);
|
||||
assert(+"-Infinity" === -Infinity);
|
||||
assert(-"Infinity" === -Infinity);
|
||||
assert(-"+Infinity" === -Infinity);
|
||||
assert(-"-Infinity" === Infinity);
|
||||
|
||||
assert(isNaN(+undefined));
|
||||
assert(isNaN(-undefined));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue