js/src/tests/test262/ch12/12.10/S12.10_A3.2_T1.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:88898f78b00c
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 * No matter how control leaves the embedded 'Statement',
6 * the scope chain is always restored to its former state
7 *
8 * @path ch12/12.10/S12.10_A3.2_T1.js
9 * @description Declaring "with" statement within a function body, leading to normal completion
10 * @noStrict
11 */
12
13 this.p1 = 1;
14
15 var result = "result";
16
17 var myObj = {
18 p1: 'a',
19 value: 'myObj_value',
20 valueOf : function(){return 'obj_valueOf';}
21 }
22
23 var f = function(){
24 with(myObj){
25 p1 = 'x1';
26 }
27 }
28
29 f();
30
31 //////////////////////////////////////////////////////////////////////////////
32 //CHECK#1
33 if(p1 !== 1){
34 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 );
35 }
36 //
37 //////////////////////////////////////////////////////////////////////////////
38
39 //////////////////////////////////////////////////////////////////////////////
40 //CHECK#2
41 if(myObj.p1 !== "x1"){
42 $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
43 }
44 //
45 //////////////////////////////////////////////////////////////////////////////
46

mercurial