S11.13.2_A4.4_T2.9.js (972B)
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: The production x += y is the same as x = x + y 6 es5id: 11.13.2_A4.4_T2.9 7 description: > 8 Type(x) is different from Type(y) and both types vary between 9 String (primitive or object) and Null 10 ---*/ 11 12 var x; 13 14 //CHECK#1 15 x = "1"; 16 x += null; 17 if (x !== "1null") { 18 throw new Test262Error('#1: x = "1"; x += null; x === "1null". Actual: ' + (x)); 19 } 20 21 //CHECK#2 22 x = null; 23 x += "1"; 24 if (x !== "null1") { 25 throw new Test262Error('#2: x = null; x += "1"; x === "null1". Actual: ' + (x)); 26 } 27 28 //CHECK#3 29 x = new String("1"); 30 x += null; 31 if (x !== "1null") { 32 throw new Test262Error('#3: x = new String("1"); x += null; x === "1null". Actual: ' + (x)); 33 } 34 35 //CHECK#4 36 x = null; 37 x += new String("1"); 38 if (x !== "null1") { 39 throw new Test262Error('#4: x = null; x += new String("1"); x === "null1". Actual: ' + (x)); 40 } 41 42 reportCompare(0, 0);