mirror of https://github.com/tc39/test262.git
parent
51822ff2d8
commit
c572588ea9
|
@ -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);
|
||||
|
||||
|
|
|
@ -24,3 +24,4 @@ assert.sameValue(
|
|||
);
|
||||
|
||||
assert.sameValue(Number("abc"), NaN, 'Number("abc") returns NaN');
|
||||
assert.sameValue(Number("INFINITY"), NaN, 'Number("INFINITY") returns NaN');
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue