Debian Codegraph @

rhino/testsrc/tests/ecma_3/Statements/regress-226517.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: 04 Dec 2003
9 * SUMMARY: |finally| statement should execute even after a |return|
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=226517
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var gTestfile = 'regress-226517.js';
16 var UBound = 0;
17 var BUGNUMBER = 226517;
18 var summary = '|finally| statement should execute even after a |return|';
19 var status = '';
20 var statusitems = [];
21 var actual = '';
22 var actualvalues = [];
23 var expect= '';
24 var expectedvalues = [];
25
26
27 /*
28 * We can only use a return statement within a function.
29 * That makes the testcase more complicated to set up -
30 */
31 function f()
32 {
33 var return_expression_was_calculated = false;
34 try
35 {
36 return (return_expression_was_calculated = true);
37 }
38 finally
39 {
40 actual = return_expression_was_calculated;
41 }
42 }
43
44
45 status = inSection(1);
46 f(); // sets |actual|
47 expect = true;
48 addThis();
49
50
51
52 //-----------------------------------------------------------------------------
53 test();
54 //-----------------------------------------------------------------------------
55
56
57
58 function addThis()
59 {
60 statusitems[UBound] = status;
61 actualvalues[UBound] = actual;
62 expectedvalues[UBound] = expect;
63 UBound++;
64 }
65
66
67 function test()
68 {
69 enterFunc('test');
70 printBugNumber(BUGNUMBER);
71 printStatus(summary);
72
73 for (var i=0; i<UBound; i++)
74 {
75 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
76 }
77
78 exitFunc ('test');
79 }