S11.6.1_A3.1_T2.3.js (1125B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, 7 then operator x + y returns ToNumber(x) + ToNumber(y) 8 es5id: 11.6.1_A3.1_T2.3 9 description: > 10 Type(Primitive(x)) is different from Type(Primitive(y)) and both 11 types vary between Number (primitive or object) and Undefined 12 ---*/ 13 14 //CHECK#1 15 if (isNaN(1 + undefined) !== true) { 16 throw new Test262Error('#1: 1 + undefined === Not-a-Number. Actual: ' + (1 + undefined)); 17 } 18 19 //CHECK#2 20 if (isNaN(undefined + 1) !== true) { 21 throw new Test262Error('#2: undefined + 1 === Not-a-Number. Actual: ' + (undefined + 1)); 22 } 23 24 //CHECK#3 25 if (isNaN(new Number(1) + undefined) !== true) { 26 throw new Test262Error('#3: new Number(1) + undefined === Not-a-Number. Actual: ' + (new Number(1) + undefined)); 27 } 28 29 //CHECK#4 30 if (isNaN(undefined + new Number(1)) !== true) { 31 throw new Test262Error('#4: undefined + new Number(1) === Not-a-Number. Actual: ' + (undefined + new Number(1))); 32 } 33 34 reportCompare(0, 0);