Skip to content

Commit

Permalink
Test that "infinity" is not recognized as numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 authored and rwaldron committed Apr 4, 2022
1 parent c572588 commit c58ac69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions implementation-contributed/v8/mjsunit/harmony/to-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions test/built-ins/Number/S15.7.1.1_A1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
5 changes: 5 additions & 0 deletions test/language/expressions/unary-plus/S11.4.6_A3_T3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

0 comments on commit c58ac69

Please sign in to comment.