1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

LibJS: Handle Infinity in Value::to_number()

This commit is contained in:
Linus Groh 2020-04-12 13:06:34 +01:00 committed by Andreas Kling
parent 477bacddad
commit f226746394
3 changed files with 17 additions and 0 deletions

View file

@ -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({})));