Debian Codegraph @

rhino/testsrc/tests/js1_5/Scope/regress-192226.js

raw symbols SCIP
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/. */
5
6 /*
7 *
8 * Date: 07 February 2003
9 * SUMMARY: Testing a nested function call under |with| or |catch|
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=192226
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var gTestfile = 'regress-192226.js';
16 var UBound = 0;
17 var BUGNUMBER = 192226;
18 var summary = 'Testing a nested function call under |with| or |catch|';
19 var status = '';
20 var statusitems = [];
21 var actual = '';
22 var actualvalues = [];
23 var expect= '';
24 var expectedvalues = [];
25 var counter = 0;
26
27
28 function f()
29 {
30 try
31 {
32 with (Math)
33 {
34 test0();
35 test1(sin);
36 }
37 throw 1;
38 }
39 catch (e)
40 {
41 test0();
42 test1(e);
43 }
44 }
45
46 function test0()
47 {
48 ++counter;
49 }
50
51 function test1(arg)
52 {
53 ++counter;
54 }
55
56
57 status = inSection(1);
58 f(); // sets |counter|
59 actual = counter;
60 expect = 4;
61 addThis();
62
63
64
65 //-----------------------------------------------------------------------------
66 test();
67 //-----------------------------------------------------------------------------
68
69
70
71 function addThis()
72 {
73 statusitems[UBound] = status;
74 actualvalues[UBound] = actual;
75 expectedvalues[UBound] = expect;
76 UBound++;
77 }
78
79
80 function test()
81 {
82 enterFunc('test');
83 printBugNumber(BUGNUMBER);
84 printStatus(summary);
85
86 for (var i=0; i<UBound; i++)
87 {
88 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
89 }
90
91 exitFunc ('test');
92 }