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

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:192393032ce5
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_T3.js
8 * @description In the check 4 we populate field getRight in __obj object since var getRight declaration adds variable to function scope
9 * but getRight in statement resolves within with(__obj) scope and searchs getRight in __obj first
10 */
11
12 p1="alert";
13
14 this.__obj={p1:1,getRight:function(){return "right";}};
15
16 var getRight=function(){return "napravo";};
17
18 resukt=(function(){
19 with(__obj){
20 p1="w1";
21 var getRight=function(){return false;};
22 return p1;
23 }
24 })();
25
26 //////////////////////////////////////////////////////////////////////////////
27 //CHECK#1
28 if (p1!=="alert") {
29 $ERROR('#1: p1 === "alert". Actual: p1==='+p1);
30 }
31 //
32 //////////////////////////////////////////////////////////////////////////////
33
34 //////////////////////////////////////////////////////////////////////////////
35 //CHECK#2
36 if (getRight()!=="napravo") {
37 $ERROR('#2: getRight() === "napravo". Actual: getRight()==='+getRight());
38 }
39 //
40 //////////////////////////////////////////////////////////////////////////////
41
42 //////////////////////////////////////////////////////////////////////////////
43 //CHECK#3
44 if (__obj.p1!=="w1") {
45 $ERROR('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1);
46 }
47 //
48 //////////////////////////////////////////////////////////////////////////////
49
50 //////////////////////////////////////////////////////////////////////////////
51 //CHECK#4
52 if (__obj.getRight()!==false) {
53 $ERROR('#4: __obj.getRight() === false. Actual: __obj.getRight()==='+__obj.getRight());
54 }
55 //
56 //////////////////////////////////////////////////////////////////////////////
57
58 //////////////////////////////////////////////////////////////////////////////
59 //CHECK#5
60 if (resukt !== "w1") {
61 $ERROR('#5: resukt === "w1". Actual: resukt ==='+resukt);
62 }
63 //
64 //////////////////////////////////////////////////////////////////////////////
65
66 var resukt;
67
68

mercurial