js/src/tests/js1_5/Regress/regress-152646.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  *
     8  * Date:    08 July 2002
     9  * SUMMARY: Testing expressions with large numbers of parentheses
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=152646
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 152646;
    16 var summary = 'Testing expressions with large numbers of parentheses';
    17 var status = '';
    18 var statusitems = [];
    19 var actual = '';
    20 var actualvalues = [];
    21 var expect= '';
    22 var expectedvalues = [];
    25 /*
    26  * Just seeing that we don't crash when compiling this assignment -
    27  *
    28  * We will form an eval string to set the result-variable |actual|.
    29  * To get a feel for this, suppose N were 3. Then the eval string is
    30  * 'actual = (((0)));' The expected value for this after eval() is 0.
    31  */
    32 status = inSection(1);
    34 var sLeft = '((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((';
    35 sLeft += sLeft;
    36 sLeft += sLeft;
    37 sLeft += sLeft;
    38 sLeft += sLeft;
    39 sLeft += sLeft;
    41 var sRight = '))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
    42 sRight += sRight;
    43 sRight += sRight;
    44 sRight += sRight;
    45 sRight += sRight;
    46 sRight += sRight;
    48 var sEval = 'actual = ' + sLeft + '0' + sRight;
    49 try
    50 {
    51   eval(sEval);
    52 }
    53 catch(e)
    54 {
    55   /*
    56    * An exception during this eval is OK, as the runtime can throw one
    57    * in response to too deep recursion. We haven't crashed; good!
    58    */
    59   actual = 0;
    60 }
    61 expect = 0;
    62 addThis();
    66 //-----------------------------------------------------------------------------
    67 test();
    68 //-----------------------------------------------------------------------------
    72 function addThis()
    73 {
    74   statusitems[UBound] = status;
    75   actualvalues[UBound] = actual;
    76   expectedvalues[UBound] = expect;
    77   UBound++;
    78 }
    81 function test()
    82 {
    83   enterFunc('test');
    84   printBugNumber(BUGNUMBER);
    85   printStatus(summary);
    87   for (var i=0; i<UBound; i++)
    88   {
    89     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    90   }
    92   exitFunc ('test');
    93 }

mercurial