js/src/tests/js1_5/Regress/regress-68498-002.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     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 = [ ];
    27 // Capture a reference to the global object -
    28 var self = this;
    30 // This function is the heart of the test -
    31 function f(s) {eval(s); actual[0]=y; return delete y;}
    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;
    38 // Set the expected-results array -
    39 expect[0] = 42;
    40 expect[1] = true;
    41 expect[2] = false;
    44 //-------------------------------------------------------------------------------------------------
    45 test();
    46 //-------------------------------------------------------------------------------------------------
    49 function test()
    50 {
    51   enterFunc ('test');
    52   printBugNumber(BUGNUMBER);
    53   printStatus (summary);
    55   for (var i in expect)
    56   {
    57     reportCompare(expect[i], actual[i], getStatus(i));
    58   }
    60   exitFunc ('test');
    61 }
    64 function getStatus(i)
    65 {
    66   return (summary  +  statprefix  +  i  +  statsuffix);
    67 }

mercurial