S12.13_A2_T6.js (1394B)
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 "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 7 evaluates Expression 8 es5id: 12.13_A2_T6 9 description: Throwing object 10 ---*/ 11 12 var myObj = {p1: 'a', 13 p2: 'b', 14 p3: 'c', 15 value: 'myObj_value', 16 valueOf : function(){return 'obj_valueOf';}, 17 parseInt : function(){return 'obj_parseInt';}, 18 NaN : 'obj_NaN', 19 Infinity : 'obj_Infinity', 20 eval : function(){return 'obj_eval';}, 21 parseFloat : function(){return 'obj_parseFloat';}, 22 isNaN : function(){return 'obj_isNaN';}, 23 isFinite : function(){return 'obj_isFinite';}, 24 i:7 25 } 26 27 try{ 28 throw myObj; 29 } 30 catch(e){ 31 // CHECK#1 32 if (e.p1!=="a") throw new Test262Error('#1: e.p1 === "a". Actual: e.p1 ==='+ e.p1 ); 33 // CHECK#2 34 if (e.value!=='myObj_value') throw new Test262Error('#2: e.p1 === \'myObj_value\'. Actual: e.p1 ==='+ e.p1 ); 35 // CHECK#3 36 if (e.eval()!=='obj_eval') throw new Test262Error('#3: e.p1 === \'obj_eval\'. Actual: e.p1 ==='+ e.p1 ); 37 } 38 39 // CHECK#4 40 myObj.i=6 41 try{ 42 throw myObj; 43 } 44 catch(e){} 45 if (myObj.i!==6) throw new Test262Error('#4: Handling of catch must be correct'); 46 47 reportCompare(0, 0);