Test that "infinity" is not recognized as numeric

This commit is contained in:
Richard Gibson 2022-03-25 08:35:50 -04:00 committed by Rick Waldron
parent c572588ea9
commit c58ac691eb
3 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@ assertEquals(-1, %ToNumber("-1"));
assertEquals(123, %ToNumber("123"));
assertEquals(NaN, %ToNumber("random text"));
assertEquals(NaN, %ToNumber("INFINITY"));
assertEquals(NaN, %ToNumber("infinity"));
assertThrows(function() { %ToNumber(Symbol.toPrimitive) }, TypeError);

View File

@ -25,3 +25,4 @@ assert.sameValue(
assert.sameValue(Number("abc"), NaN, 'Number("abc") returns NaN');
assert.sameValue(Number("INFINITY"), NaN, 'Number("INFINITY") returns NaN');
assert.sameValue(Number("infinity"), NaN, 'Number("infinity") returns NaN');

View File

@ -26,3 +26,8 @@ if (isNaN(+"x") !== true) {
if (isNaN(+"INFINITY") !== true) {
throw new Test262Error('#4: +"INFINITY" === Not-a-Number. Actual: ' + (+"INFINITY"));
}
//CHECK#5
if (isNaN(+"infinity") !== true) {
throw new Test262Error('#5: +"infinity" === Not-a-Number. Actual: ' + (+"infinity"));
}