S11.11.2_A4_T3.js (1154B)
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: If ToBoolean(x) is true, return x 6 es5id: 11.11.2_A4_T3 7 description: Type(x) and Type(y) vary between primitive string and String object 8 ---*/ 9 10 //CHECK#1 11 if (("-1" || "1") !== "-1") { 12 throw new Test262Error('#-1: ("-1" || "1") === "-1"'); 13 } 14 15 //CHECK#2 16 if (("-1" || "x") !== "-1") { 17 throw new Test262Error('#2: ("-1" || "x") === "-1"'); 18 } 19 20 //CHECK#3 21 var x = new String("-1"); 22 if ((x || new String(-1)) !== x) { 23 throw new Test262Error('#3: (var x = new String("-1"); (x || new String(-1)) === x'); 24 } 25 26 //CHECK#4 27 var x = new String(NaN); 28 if ((x || new String("1")) !== x) { 29 throw new Test262Error('#4: (var x = new String(NaN); (x || new String("1")) === x'); 30 } 31 32 //CHECK#5 33 var x = new String("-x"); 34 if ((x || new String("x")) !== x) { 35 throw new Test262Error('#5: (var x = new String("-x"); (x || new String("x")) === x'); 36 } 37 38 //CHECK#6 39 var x = new String(0); 40 if ((x || new String(NaN)) !== x) { 41 throw new Test262Error('#6: (var x = new String(0); (x || new String(NaN)) === x'); 42 } 43 44 reportCompare(0, 0);