S11.6.1_A3.2_T2.3.js (1186B)
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 String or Type(Primitive(y)) is String, then 7 operator x + y returns the result of concatenating ToString(x) followed 8 by ToString(y) 9 es5id: 11.6.1_A3.2_T2.3 10 description: > 11 Type(Primitive(x)) is different from Type(Primitive(y)) and both 12 types vary between String (primitive or object) and Undefined 13 ---*/ 14 15 //CHECK#1 16 if ("1" + undefined !== "1undefined") { 17 throw new Test262Error('#1: "1" + undefined === "1undefined". Actual: ' + ("1" + undefined)); 18 } 19 20 //CHECK#2 21 if (undefined + "1" !== "undefined1") { 22 throw new Test262Error('#2: undefined + "1" === "undefined1". Actual: ' + (undefined + "1")); 23 } 24 25 //CHECK#3 26 if (new String("1") + undefined !== "1undefined") { 27 throw new Test262Error('#3: new String("1") + undefined === "1undefined". Actual: ' + (new String("1") + undefined)); 28 } 29 30 //CHECK#4 31 if (undefined + new String("1") !== "undefined1") { 32 throw new Test262Error('#4: undefined + new String("1") === "undefined1". Actual: ' + (undefined + new String("1"))); 33 } 34 35 reportCompare(0, 0);