Debian Codegraph @

rhino/testsrc/tests/js1_7/geniter/regress-349012-02.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 var gTestfile = 'regress-349012-02.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 349012;
9 var summary = 'generators with nested try finally blocks';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 expect = "[object StopIteration]";
25 var expectyield = "12";
26 var expectfinally = "Inner finally,Outer finally";
27 var actualyield = "";
28 var actualfinally = "";
29
30 function gen()
31 {
32 try {
33 try {
34 yield 1;
35 } finally {
36 actualfinally += "Inner finally";
37 yield 2;
38 }
39 } finally {
40 actualfinally += ",Outer finally";
41 }
42 }
43
44 var iter = gen();
45 actualyield += iter.next();
46 actualyield += iter.next();
47 try
48 {
49 actualyield += iter.next();
50 actual = "No exception";
51 }
52 catch(ex)
53 {
54 actual = ex + '';
55 }
56
57 reportCompare(expect, actual, summary);
58 reportCompare(expectyield, actualyield, summary);
59 reportCompare(expectfinally, actualfinally, summary);
60
61 exitFunc ('test');
62 }