S13.2.2_A17_T2.js (2062B)
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: FunctionExpression containing "with" statement is admitted 6 es5id: 13.2.2_A17_T2 7 description: Throwing an exception within "with" statement 8 flags: [noStrict] 9 ---*/ 10 11 this.p1="alert"; 12 13 __obj={p1:1,getRight:function(){return "right";}}; 14 15 getRight=function(){return "napravo";}; 16 17 try { 18 (function(){ 19 with(__obj){ 20 p1="w1"; 21 getRight=function(){return false;} 22 throw p1; 23 } 24 })(); 25 } catch (e) { 26 resukt = p1; 27 } 28 29 30 ////////////////////////////////////////////////////////////////////////////// 31 //CHECK#1 32 if (p1!=="alert") { 33 throw new Test262Error('#1: p1 === "alert". Actual: p1==='+p1); 34 } 35 // 36 ////////////////////////////////////////////////////////////////////////////// 37 38 ////////////////////////////////////////////////////////////////////////////// 39 //CHECK#2 40 if (getRight()!=="napravo") { 41 throw new Test262Error('#2: getRight() === "napravo". Actual: getRight() === '+getRight()); 42 } 43 // 44 ////////////////////////////////////////////////////////////////////////////// 45 46 ////////////////////////////////////////////////////////////////////////////// 47 //CHECK#3 48 if (__obj.p1!=="w1") { 49 throw new Test262Error('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1); 50 } 51 // 52 ////////////////////////////////////////////////////////////////////////////// 53 54 ////////////////////////////////////////////////////////////////////////////// 55 //CHECK#4 56 if (__obj.getRight()!==false) { 57 throw new Test262Error('#4: __obj.getRight() === false. Actual: __obj.getRight() === '+__obj.getRight()); 58 } 59 // 60 ////////////////////////////////////////////////////////////////////////////// 61 62 ////////////////////////////////////////////////////////////////////////////// 63 //CHECK#5 64 if (resukt !== "alert") { 65 throw new Test262Error('#5: resukt === "alert". Actual: resukt ==='+resukt); 66 } 67 // 68 ////////////////////////////////////////////////////////////////////////////// 69 70 var resukt; 71 72 reportCompare(0, 0);