S11.2.2_A4_T1.js (1179B)
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 NewExpression or MemberExpression does not implement internal 7 [[Construct]] method, throw TypeError 8 es5id: 11.2.2_A4_T1 9 description: Checking Boolean object case 10 ---*/ 11 12 //CHECK#1 13 try { 14 new new Boolean(true); 15 throw new Test262Error('#1: new new Boolean(true) throw TypeError'); 16 } 17 catch (e) { 18 if ((e instanceof TypeError) !== true) { 19 throw new Test262Error('#1: new new Boolean(true) throw TypeError'); 20 } 21 } 22 23 //CHECK#2 24 try { 25 var x = new Boolean(true); 26 new x; 27 throw new Test262Error('#2: var x = new Boolean(true); new x throw TypeError'); 28 } 29 catch (e) { 30 if ((e instanceof TypeError) !== true) { 31 throw new Test262Error('#2: var x = new Boolean(true); new x throw TypeError'); 32 } 33 } 34 35 //CHECK#3 36 try { 37 var x = new Boolean(true); 38 new x(); 39 throw new Test262Error('#3: var x = new Boolean(true); new x() throw TypeError'); 40 } 41 catch (e) { 42 if ((e instanceof TypeError) !== true) { 43 throw new Test262Error('#3: var x = new Boolean(true); new x() throw TypeError'); 44 } 45 } 46 47 reportCompare(0, 0);