S12.5_A1.2_T1.js (2825B)
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 1, true, non-empty string and others in expression is evaluated to true 7 when using operator "new" 8 es5id: 12.5_A1.2_T1 9 description: Using "if" without "else" construction 10 ---*/ 11 12 ////////////////////////////////////////////////////////////////////////////// 13 //CHECK#1 14 if(!(new Number(1))) 15 throw new Test262Error('#1: new 1 in expression is evaluated to true'); 16 // 17 ////////////////////////////////////////////////////////////////////////////// 18 19 ////////////////////////////////////////////////////////////////////////////// 20 //CHECK#2 21 if(!(new Boolean(true))) 22 throw new Test262Error('#2: new true in expression is evaluated to true'); 23 // 24 ////////////////////////////////////////////////////////////////////////////// 25 26 ////////////////////////////////////////////////////////////////////////////// 27 //CHECK#3 28 if(!(new String("1"))) 29 throw new Test262Error('#3: new "1" in expression is evaluated to true'); 30 // 31 ////////////////////////////////////////////////////////////////////////////// 32 33 ////////////////////////////////////////////////////////////////////////////// 34 //CHECK#4 35 if(!(new String("A"))) 36 throw new Test262Error('#4: new "A" in expression is evaluated to true'); 37 // 38 ////////////////////////////////////////////////////////////////////////////// 39 40 ////////////////////////////////////////////////////////////////////////////// 41 //CHECK#5 42 if(!(new Boolean(false))) 43 throw new Test262Error('#2: new false in expression is evaluated to true '); 44 // 45 ////////////////////////////////////////////////////////////////////////////// 46 47 ////////////////////////////////////////////////////////////////////////////// 48 //CHECK#6 49 if(!(new Number(NaN))) 50 throw new Test262Error('#6: new NaN in expression is evaluated to true '); 51 // 52 ////////////////////////////////////////////////////////////////////////////// 53 54 ////////////////////////////////////////////////////////////////////////////// 55 //CHECK#7 56 if(!(new Number(null))) 57 throw new Test262Error('#7: new null in expression is evaluated to true '); 58 // 59 ////////////////////////////////////////////////////////////////////////////// 60 61 ////////////////////////////////////////////////////////////////////////////// 62 //CHECK#8 63 if(!(new String(undefined))) 64 throw new Test262Error('#8: new undefined in expression is evaluated to true '); 65 // 66 ////////////////////////////////////////////////////////////////////////////// 67 68 ////////////////////////////////////////////////////////////////////////////// 69 //CHECK#9 70 if(!(new String(""))) 71 throw new Test262Error('#9: new empty string in expression is evaluated to true '); 72 // 73 ////////////////////////////////////////////////////////////////////////////// 74 75 reportCompare(0, 0);