js/src/tests/ecma_5/strict/eval-variable-environment.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/licenses/publicdomain/
     4  */
     6 var code;
     8 code =
     9   "eval('var x = 2; typeof x');";
    10 assertEq(testLenientAndStrict(code, returns("number"), returns("number")),
    11          true);
    13 code =
    14   "eval('\"use strict\"; var x = 2; typeof x');";
    15 assertEq(testLenientAndStrict(code, returns("number"), returns("number")),
    16          true);
    18 code =
    19   "eval('var x = 2;'); " +
    20   "typeof x";
    21 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")),
    22          true);
    24 code =
    25   "eval('\"use strict\"; var x = 2;'); " +
    26   "typeof x";
    27 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    28          true);
    30 code =
    31   "eval('\"use strict\"; var x = 2; typeof x'); " +
    32   "typeof x";
    33 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    34          true);
    36 code =
    37   "function test() " +
    38   "{ " +
    39   "  eval('var x = 2;'); " +
    40   "  return typeof x; " +
    41   "} " +
    42   "test();";
    43 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")),
    44          true);
    46 code =
    47   "function test() " +
    48   "{ " +
    49   "  'use strict'; " +
    50   "  eval('var x = 2;'); " +
    51   "  return typeof x; " +
    52   "} " +
    53   "test();";
    54 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    55          true);
    57 code =
    58   "function test() " +
    59   "{ " +
    60   "  eval('\"use strict\"; var x = 2;'); " +
    61   "  return typeof x; " +
    62   "} " +
    63   "test();";
    64 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
    65          true);
    67 reportCompare(true, true);

mercurial