S11.13.2_A4.6_T2.5.js (1620B)
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.6_T2.5 7 description: > 8 Type(x) is different from Type(y) and both types vary between 9 String (primitive or object) and Boolean (primitive and object) 10 ---*/ 11 12 var x; 13 14 //CHECK#1 15 x = true; 16 x <<= "1"; 17 if (x !== 2) { 18 throw new Test262Error('#1: x = true; x <<= "1"; x === 2. Actual: ' + (x)); 19 } 20 21 //CHECK#2 22 x = "1"; 23 x <<= true; 24 if (x !== 2) { 25 throw new Test262Error('#2: x = "1"; x <<= true; x === 2. Actual: ' + (x)); 26 } 27 28 //CHECK#3 29 x = new Boolean(true); 30 x <<= "1"; 31 if (x !== 2) { 32 throw new Test262Error('#3: x = new Boolean(true); x <<= "1"; x === 2. Actual: ' + (x)); 33 } 34 35 //CHECK#4 36 x = "1"; 37 x <<= new Boolean(true); 38 if (x !== 2) { 39 throw new Test262Error('#4: x = "1"; x <<= new Boolean(true); x === 2. Actual: ' + (x)); 40 } 41 42 //CHECK#5 43 x = true; 44 x <<= new String("1"); 45 if (x !== 2) { 46 throw new Test262Error('#5: x = true; x <<= new String("1"); x === 2. Actual: ' + (x)); 47 } 48 49 //CHECK#6 50 x = new String("1"); 51 x <<= true; 52 if (x !== 2) { 53 throw new Test262Error('#6: x = new String("1"); x <<= true; x === 2. Actual: ' + (x)); 54 } 55 56 //CHECK#7 57 x = new Boolean(true); 58 x <<= new String("1"); 59 if (x !== 2) { 60 throw new Test262Error('#7: x = new Boolean(true); x <<= new String("1"); x === 2. Actual: ' + (x)); 61 } 62 63 //CHECK#8 64 x = new String("1"); 65 x <<= new Boolean(true); 66 if (x !== 2) { 67 throw new Test262Error('#8: x = new String("1"); x <<= new Boolean(true); x === 2. Actual: ' + (x)); 68 } 69 70 reportCompare(0, 0);