js/src/tests/js1_4/Eval/regress-531682.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_4/Eval/regress-531682.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/*
     1.6 + * Any copyright is dedicated to the Public Domain.
     1.7 + * http://creativecommons.org/licenses/publicdomain/
     1.8 + */
     1.9 +
    1.10 +//-----------------------------------------------------------------------------
    1.11 +var BUGNUMBER = 531682;
    1.12 +var summary = 'Checking proper wrapping of scope in  eval(source, scope)';
    1.13 +var actual;
    1.14 +var expect;
    1.15 +
    1.16 +//-----------------------------------------------------------------------------
    1.17 +var x = 0;
    1.18 +
    1.19 +test();
    1.20 +//-----------------------------------------------------------------------------
    1.21 +
    1.22 +function scope1() {
    1.23 +    eval('var x = 1;');
    1.24 +    return function() { return x; }
    1.25 +}
    1.26 +
    1.27 +function test() {
    1.28 +    enterFunc ('test');
    1.29 +    printBugNumber(BUGNUMBER);
    1.30 +    printStatus (summary);
    1.31 +
    1.32 +    // The scope chain in eval should be just scope1() and the global object.
    1.33 +    actual = eval('x', scope1());
    1.34 +    expect = 0;
    1.35 +    reportCompare(expect, actual, summary);
    1.36 +    exitFunc ('test');
    1.37 +}

mercurial