S11.6.1_A3.2_T1.1.js (1314B)
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_T1.1 10 description: > 11 Type(Primitive(x)) and Type(Primitive(y)) vary between primitive 12 string and String object 13 ---*/ 14 15 //CHECK#1 16 if ("1" + "1" !== "11") { 17 throw new Test262Error('#1: "1" + "1" === "11". Actual: ' + ("1" + "1")); 18 } 19 20 //CHECK#2 21 if (new String("1") + "1" !== "11") { 22 throw new Test262Error('#2: new String("1") + "1" === "11". Actual: ' + (new String("1") + "1")); 23 } 24 25 //CHECK#3 26 if ("1" + new String("1") !== "11") { 27 throw new Test262Error('#3: "1" + new String("1") === "11". Actual: ' + ("1" + new String("1"))); 28 } 29 30 //CHECK#4 31 if (new String("1") + new String("1") !== "11") { 32 throw new Test262Error('#4: new String("1") + new String("1") === "11". Actual: ' + (new String("1") + new String("1"))); 33 } 34 35 //CHECK#5 36 if ("x" + "1" !=="x1") { 37 throw new Test262Error('#5: "x" + "1" === "x1". Actual: ' + ("x" + "1")); 38 } 39 40 //CHECK#6 41 if ("1" + "x" !== "1x") { 42 throw new Test262Error('#6: "1" + "x" === "1x". Actual: ' + ("1" + "x")); 43 } 44 45 reportCompare(0, 0);