js/src/tests/test262/ch13/13.2/S13.2.2_A17_T2.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:0d4a6403c3e3
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 * FunctionExpression containing "with" statement is admitted
6 *
7 * @path ch13/13.2/S13.2.2_A17_T2.js
8 * @description Throwing an exception within "with" statement
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 $ERROR('#1: p1 === "alert". Actual: p1==='+p1);
34 }
35 //
36 //////////////////////////////////////////////////////////////////////////////
37
38 //////////////////////////////////////////////////////////////////////////////
39 //CHECK#2
40 if (getRight()!=="napravo") {
41 $ERROR('#2: getRight() === "napravo". Actual: getRight() === '+getRight());
42 }
43 //
44 //////////////////////////////////////////////////////////////////////////////
45
46 //////////////////////////////////////////////////////////////////////////////
47 //CHECK#3
48 if (__obj.p1!=="w1") {
49 $ERROR('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1);
50 }
51 //
52 //////////////////////////////////////////////////////////////////////////////
53
54 //////////////////////////////////////////////////////////////////////////////
55 //CHECK#4
56 if (__obj.getRight()!==false) {
57 $ERROR('#4: __obj.getRight() === false. Actual: __obj.getRight() === '+__obj.getRight());
58 }
59 //
60 //////////////////////////////////////////////////////////////////////////////
61
62 //////////////////////////////////////////////////////////////////////////////
63 //CHECK#5
64 if (resukt !== "alert") {
65 $ERROR('#5: resukt === "alert". Actual: resukt ==='+resukt);
66 }
67 //
68 //////////////////////////////////////////////////////////////////////////////
69
70 var resukt;
71
72

mercurial