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