js/src/tests/js1_8_1/regress/regress-509354.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

     1 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/licenses/publicdomain/
     4  * Contributor: Jason Orendorff <jorendorff@mozilla.com>
     5  */
     7 // Decompile destructuring argument named `arguments` correctly.
     8 var actual = "" + function ([arguments]) {return arguments;};
     9 compareSource('function ([arguments]) {return arguments;}', actual, "part 1");
    11 // Make sure the 'arguments' argument actually works.
    12 var f = function ([arguments]) {return arguments + 1;};
    13 reportCompare(3.25, f([2.25]), "part 2");
    15 // Throw SyntaxError when `arguments` appears twice in a destructuring parameter.
    16 actual = "no exception";
    17 try {
    18     eval('(function ([arguments, arguments]) {return arguments();})');
    19 } catch (exc) {
    20     actual = exc.name;
    21 }
    22 reportCompare("SyntaxError", actual, "part 3");
    24 // And again...
    25 actual = "no exception";
    26 try {
    27     eval('(function ([a, b, arguments, d], [e, f, arguments]) {return arguments();})');
    28 } catch (exc) {
    29     actual = exc.name;
    30 }
    31 reportCompare("SyntaxError", actual, "part 4");
    33 // The original test case from bug 509354. Don't crash.
    34 try {
    35     eval('print(function([arguments,arguments,arguments,arguments,arguments,' +
    36          'arguments,arguments,arguments,arguments,arguments,arguments,' +
    37          'arguments,arguments,arguments,arguments,arguments]){})');
    38 } catch (exc) {
    39 }
    40 reportCompare("no crash", "no crash", "part 5");

mercurial