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: * FunctionExpression containing "with" statement is admitted michael@0: * michael@0: * @path ch13/13.2/S13.2.2_A17_T2.js michael@0: * @description Throwing an exception within "with" statement michael@0: */ michael@0: michael@0: this.p1="alert"; michael@0: michael@0: __obj={p1:1,getRight:function(){return "right";}}; michael@0: michael@0: getRight=function(){return "napravo";}; michael@0: michael@0: try { michael@0: (function(){ michael@0: with(__obj){ michael@0: p1="w1"; michael@0: getRight=function(){return false;} michael@0: throw p1; michael@0: } michael@0: })(); michael@0: } catch (e) { michael@0: resukt = p1; michael@0: } michael@0: michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: if (p1!=="alert") { michael@0: $ERROR('#1: p1 === "alert". Actual: p1==='+p1); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#2 michael@0: if (getRight()!=="napravo") { michael@0: $ERROR('#2: getRight() === "napravo". Actual: getRight() === '+getRight()); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#3 michael@0: if (__obj.p1!=="w1") { michael@0: $ERROR('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#4 michael@0: if (__obj.getRight()!==false) { michael@0: $ERROR('#4: __obj.getRight() === false. Actual: __obj.getRight() === '+__obj.getRight()); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#5 michael@0: if (resukt !== "alert") { michael@0: $ERROR('#5: resukt === "alert". Actual: resukt ==='+resukt); michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: var resukt; michael@0: michael@0: