1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/Regress/regress-68498-002.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * Date: 15 Feb 2001 1.11 + * 1.12 + * SUMMARY: create a Deletable local variable using eval 1.13 + * 1.14 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=68498 1.15 + * See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251 1.16 + * 1.17 + * Brendan: 1.18 + * 1.19 + * "Demonstrate the creation of a Deletable local variable using eval" 1.20 + */ 1.21 +//----------------------------------------------------------------------------- 1.22 +var BUGNUMBER = 68498; 1.23 +var summary = 'Creating a Deletable local variable using eval'; 1.24 +var statprefix = '; currently at expect['; 1.25 +var statsuffix = '] within test -'; 1.26 +var actual = [ ]; 1.27 +var expect = [ ]; 1.28 + 1.29 + 1.30 +// Capture a reference to the global object - 1.31 +var self = this; 1.32 + 1.33 +// This function is the heart of the test - 1.34 +function f(s) {eval(s); actual[0]=y; return delete y;} 1.35 + 1.36 + 1.37 +// Set the actual-results array. The next line will set actual[0] and actual[1] in one shot 1.38 +actual[1] = f('var y = 42'); 1.39 +actual[2] = 'y' in self && y; 1.40 + 1.41 +// Set the expected-results array - 1.42 +expect[0] = 42; 1.43 +expect[1] = true; 1.44 +expect[2] = false; 1.45 + 1.46 + 1.47 +//------------------------------------------------------------------------------------------------- 1.48 +test(); 1.49 +//------------------------------------------------------------------------------------------------- 1.50 + 1.51 + 1.52 +function test() 1.53 +{ 1.54 + enterFunc ('test'); 1.55 + printBugNumber(BUGNUMBER); 1.56 + printStatus (summary); 1.57 + 1.58 + for (var i in expect) 1.59 + { 1.60 + reportCompare(expect[i], actual[i], getStatus(i)); 1.61 + } 1.62 + 1.63 + exitFunc ('test'); 1.64 +} 1.65 + 1.66 + 1.67 +function getStatus(i) 1.68 +{ 1.69 + return (summary + statprefix + i + statsuffix); 1.70 +}