1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.11_T2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * No matter how control leaves the embedded 'Statement', 1.9 + * the scope chain is always restored to its former state 1.10 + * 1.11 + * @path ch12/12.10/S12.10_A3.11_T2.js 1.12 + * @description Calling a function within "with" statement declared without the statement, leading to normal completion by "return" 1.13 + * @noStrict 1.14 + */ 1.15 + 1.16 +this.p1 = 1; 1.17 +var result = "result"; 1.18 +var value = "value"; 1.19 +var myObj = {p1: 'a', 1.20 + value: 'myObj_value', 1.21 + valueOf : function(){return 'obj_valueOf';} 1.22 +} 1.23 + 1.24 +var f = function(){ 1.25 + p1 = 'x1'; 1.26 + return value; 1.27 +} 1.28 + 1.29 +with(myObj){ 1.30 + result = f(); 1.31 +} 1.32 + 1.33 +if(!(p1 === "x1")){ 1.34 + $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 ); 1.35 +} 1.36 + 1.37 +if(!(myObj.p1 === "a")){ 1.38 + $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); 1.39 +} 1.40 + 1.41 +if(!(result === "value")){ 1.42 + $ERROR('#3: result === "value". Actual: result ==='+ result ); 1.43 +} 1.44 +