Debian Codegraph @

js/src/tests/non262/regress/regress-68498-002.js

raw
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * Date: 15 Feb 2001
8 *
9 * SUMMARY: create a Deletable local variable using eval
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
12 * See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
13 *
14 * Brendan:
15 *
16 * "Demonstrate the creation of a Deletable local variable using eval"
17 */
18 //-----------------------------------------------------------------------------
19 var BUGNUMBER = 68498;
20 var summary = 'Creating a Deletable local variable using eval';
21 var statprefix = '; currently at expect[';
22 var statsuffix = '] within test -';
23 var actual = [ ];
24 var expect = [ ];
25
26
27 // Capture a reference to the global object -
28 var self = this;
29
30 // This function is the heart of the test -
31 function f(s) {eval(s); actual[0]=y; return delete y;}
32
33
34 // Set the actual-results array. The next line will set actual[0] and actual[1] in one shot
35 actual[1] = f('var y = 42');
36 actual[2] = 'y' in self && y;
37
38 // Set the expected-results array -
39 expect[0] = 42;
40 expect[1] = true;
41 expect[2] = false;
42
43
44 //-------------------------------------------------------------------------------------------------
45 test();
46 //-------------------------------------------------------------------------------------------------
47
48
49 function test()
50 {
51 printBugNumber(BUGNUMBER);
52 printStatus (summary);
53
54 for (var i in expect)
55 {
56 reportCompare(expect[i], actual[i], getStatus(i));
57 }
58 }
59
60
61 function getStatus(i)
62 {
63 return (summary + statprefix + i + statsuffix);
64 }