michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1 evaluates Expression michael@0: * michael@0: * @path ch12/12.13/S12.13_A2_T6.js michael@0: * @description Throwing object michael@0: */ michael@0: michael@0: var myObj = {p1: 'a', michael@0: p2: 'b', michael@0: p3: 'c', michael@0: value: 'myObj_value', michael@0: valueOf : function(){return 'obj_valueOf';}, michael@0: parseInt : function(){return 'obj_parseInt';}, michael@0: NaN : 'obj_NaN', michael@0: Infinity : 'obj_Infinity', michael@0: eval : function(){return 'obj_eval';}, michael@0: parseFloat : function(){return 'obj_parseFloat';}, michael@0: isNaN : function(){return 'obj_isNaN';}, michael@0: isFinite : function(){return 'obj_isFinite';}, michael@0: i:7 michael@0: } michael@0: michael@0: try{ michael@0: throw myObj; michael@0: } michael@0: catch(e){ michael@0: // CHECK#1 michael@0: if (e.p1!=="a") $ERROR('#1: e.p1 === "a". Actual: e.p1 ==='+ e.p1 ); michael@0: // CHECK#2 michael@0: if (e.value!=='myObj_value') $ERROR('#2: e.p1 === \'myObj_value\'. Actual: e.p1 ==='+ e.p1 ); michael@0: // CHECK#3 michael@0: if (e.eval()!=='obj_eval') $ERROR('#3: e.p1 === \'obj_eval\'. Actual: e.p1 ==='+ e.p1 ); michael@0: } michael@0: michael@0: // CHECK#4 michael@0: myObj.i=6 michael@0: try{ michael@0: throw myObj; michael@0: } michael@0: catch(e){} michael@0: if (myObj.i!==6) $ERROR('#4: Handling of catch must be correct'); michael@0: