Skip to content

Commit c572588

Browse files
gibson042rwaldron
authored andcommitted
Test that "INFINITY" is not recognized as numeric
Fixes #3442
1 parent 51822ff commit c572588

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

implementation-contributed/v8/mjsunit/harmony/to-number.js

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ assertEquals(NaN, %ToNumber(undefined));
1919
assertEquals(-1, %ToNumber("-1"));
2020
assertEquals(123, %ToNumber("123"));
2121
assertEquals(NaN, %ToNumber("random text"));
22+
assertEquals(NaN, %ToNumber("INFINITY"));
2223

2324
assertThrows(function() { %ToNumber(Symbol.toPrimitive) }, TypeError);
2425

test/built-ins/Number/S15.7.1.1_A1.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ assert.sameValue(
2424
);
2525

2626
assert.sameValue(Number("abc"), NaN, 'Number("abc") returns NaN');
27+
assert.sameValue(Number("INFINITY"), NaN, 'Number("INFINITY") returns NaN');

test/language/expressions/unary-plus/S11.4.6_A3_T3.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ if (+"1" !== 1) {
1313
}
1414

1515
//CHECK#2
16-
if (isNaN(+"x") !== true) {
17-
throw new Test262Error('#2: +"x" === Not-a-Number. Actual: ' + (+"x"));
16+
if (+new Number("-1") !== -1) {
17+
throw new Test262Error('#2: +new String("-1") === -1. Actual: ' + (+new String("-1")));
1818
}
1919

2020
//CHECK#3
21-
if (+new Number("-1") !== -1) {
22-
throw new Test262Error('#3: +new String("-1") === -1. Actual: ' + (+new String("-1")));
21+
if (isNaN(+"x") !== true) {
22+
throw new Test262Error('#3: +"x" === Not-a-Number. Actual: ' + (+"x"));
23+
}
24+
25+
//CHECK#4
26+
if (isNaN(+"INFINITY") !== true) {
27+
throw new Test262Error('#4: +"INFINITY" === Not-a-Number. Actual: ' + (+"INFINITY"));
2328
}

0 commit comments

Comments
 (0)