Debian Codegraph @

rhino/testsrc/tests/js1_5/Regress/regress-68498-002.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 gTestfile = 'regress-68498-002.js';
20 var BUGNUMBER = 68498;
21 var summary = 'Creating a Deletable local variable using eval';
22 var statprefix = '; currently at expect[';
23 var statsuffix = '] within test -';
24 var actual = [ ];
25 var expect = [ ];
26
27
28 // Capture a reference to the global object -
29 var self = this;
30
31 // This function is the heart of the test -
32 function f(s) {eval(s); actual[0]=y; return delete y;}
33
34
35 // Set the actual-results array. The next line will set actual[0] and actual[1] in one shot
36 actual[1] = f('var y = 42');
37 actual[2] = 'y' in self && y;
38
39 // Set the expected-results array -
40 expect[0] = 42;
41 expect[1] = true;
42 expect[2] = false;
43
44
45 //-------------------------------------------------------------------------------------------------
46 test();
47 //-------------------------------------------------------------------------------------------------
48
49
50 function test()
51 {
52 enterFunc ('test');
53 printBugNumber(BUGNUMBER);
54 printStatus (summary);
55
56 for (var i in expect)
57 {
58 reportCompare(expect[i], actual[i], getStatus(i));
59 }
60
61 exitFunc ('test');
62 }
63
64
65 function getStatus(i)
66 {
67 return (summary + statprefix + i + statsuffix);
68 }