Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / js1_8_5 / extensions / recursion.js
1 /*
2  * Any copyright is dedicated to the Public Domain.
3  * http://creativecommons.org/licenses/publicdomain/
4  * Contributor:
5  *   Christian Holler <decoder@own-hero.net>
6  */
7
8 //-----------------------------------------------------------------------------
9 var BUGNUMBER = 622167;
10 var summary = 'Handle infinite recursion';
11 print(BUGNUMBER + ": " + summary);
12
13 /**************
14  * BEGIN TEST *
15  **************/
16
17 function eval() { eval(); }
18
19 function DoWhile_3()
20 {
21   eval();
22 }
23
24 try
25 {
26   DoWhile_3();
27 }
28 catch(e) { }
29
30 var r;
31 function f()
32 {
33   r = arguments;
34   test();
35   yield 170;
36 }
37
38 function test()
39 {
40   function foopy()
41   {
42     try
43     {
44       for (var i in f());
45     }
46     catch (e) { }
47   }
48   foopy();
49   gc();
50 }
51 test();
52
53 /******************************************************************************/
54
55 if (typeof reportCompare === "function")
56   reportCompare(true, true);
57
58 print("All tests passed!");