diff --git a/implementation-contributed/v8/mjsunit/harmony/to-number.js b/implementation-contributed/v8/mjsunit/harmony/to-number.js index a48a7d83f8c..c5a06cf4ffe 100644 --- a/implementation-contributed/v8/mjsunit/harmony/to-number.js +++ b/implementation-contributed/v8/mjsunit/harmony/to-number.js @@ -19,6 +19,7 @@ assertEquals(NaN, %ToNumber(undefined)); assertEquals(-1, %ToNumber("-1")); assertEquals(123, %ToNumber("123")); assertEquals(NaN, %ToNumber("random text")); +assertEquals(NaN, %ToNumber("INFINITY")); assertThrows(function() { %ToNumber(Symbol.toPrimitive) }, TypeError); diff --git a/test/built-ins/Number/S15.7.1.1_A1.js b/test/built-ins/Number/S15.7.1.1_A1.js index 3ccfaf32ae3..ebecc20106c 100644 --- a/test/built-ins/Number/S15.7.1.1_A1.js +++ b/test/built-ins/Number/S15.7.1.1_A1.js @@ -24,3 +24,4 @@ assert.sameValue( ); assert.sameValue(Number("abc"), NaN, 'Number("abc") returns NaN'); +assert.sameValue(Number("INFINITY"), NaN, 'Number("INFINITY") returns NaN'); diff --git a/test/language/expressions/unary-plus/S11.4.6_A3_T3.js b/test/language/expressions/unary-plus/S11.4.6_A3_T3.js index 79bf732a2f2..cb6c4546156 100644 --- a/test/language/expressions/unary-plus/S11.4.6_A3_T3.js +++ b/test/language/expressions/unary-plus/S11.4.6_A3_T3.js @@ -13,11 +13,16 @@ if (+"1" !== 1) { } //CHECK#2 -if (isNaN(+"x") !== true) { - throw new Test262Error('#2: +"x" === Not-a-Number. Actual: ' + (+"x")); +if (+new Number("-1") !== -1) { + throw new Test262Error('#2: +new String("-1") === -1. Actual: ' + (+new String("-1"))); } //CHECK#3 -if (+new Number("-1") !== -1) { - throw new Test262Error('#3: +new String("-1") === -1. Actual: ' + (+new String("-1"))); +if (isNaN(+"x") !== true) { + throw new Test262Error('#3: +"x" === Not-a-Number. Actual: ' + (+"x")); +} + +//CHECK#4 +if (isNaN(+"INFINITY") !== true) { + throw new Test262Error('#4: +"INFINITY" === Not-a-Number. Actual: ' + (+"INFINITY")); }