1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch13/13.2/S13.2.2_A19_T8.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 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 + * Function's scope chain is started when it is declared 1.9 + * 1.10 + * @path ch13/13.2/S13.2.2_A19_T8.js 1.11 + * @description Function is declared multiply times 1.12 + */ 1.13 + 1.14 +////////////////////////////////////////////////////////////////////////////// 1.15 +//CHECK#0 1.16 +if (typeof __func !== "undefined") { 1.17 + $ERROR('#0: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func); 1.18 +} 1.19 +// 1.20 +////////////////////////////////////////////////////////////////////////////// 1.21 + 1.22 +var a = 1, b = "a"; 1.23 + 1.24 +var __obj = {a:2}; 1.25 + 1.26 +with (__obj) 1.27 +{ 1.28 + while(1){ 1.29 + var __func = function() 1.30 + { 1.31 + return a; 1.32 + }; 1.33 + break; 1.34 + } 1.35 +} 1.36 + 1.37 +delete __obj; 1.38 + 1.39 +////////////////////////////////////////////////////////////////////////////// 1.40 +//CHECK#1 1.41 +if (__func() !== 2) { 1.42 + $ERROR('#1: __func() === 2. Actual: __func() ==='+__func()); 1.43 +} 1.44 +// 1.45 +////////////////////////////////////////////////////////////////////////////// 1.46 + 1.47 +var __obj = {a:3,b:"b"}; 1.48 + 1.49 +with (__obj) 1.50 +{ 1.51 + var __func = function() 1.52 + { 1.53 + return b; 1.54 + } 1.55 +} 1.56 + 1.57 +delete __obj; 1.58 + 1.59 +////////////////////////////////////////////////////////////////////////////// 1.60 +//CHECK#2 1.61 +if (__func()!=="b") { 1.62 + $ERROR('#2: __func()==="b". Actual: __func()==='+__func()); 1.63 +} 1.64 +// 1.65 +////////////////////////////////////////////////////////////////////////////// 1.66 + 1.67 +with ({a:99,b:"c"}) 1.68 +{ 1.69 + ////////////////////////////////////////////////////////////////////////////// 1.70 + //CHECK#3 1.71 + if (__func() !== "b") { 1.72 + $ERROR('#3: __func()==="b". Actual: __func()==='+__func()); 1.73 + } 1.74 + // 1.75 + ////////////////////////////////////////////////////////////////////////////// 1.76 +} 1.77 +