Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/catchguard-002.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 var gTestfile = 'catchguard-002.js';
8
9 test();
10
11 function test()
12 {
13 enterFunc ("test");
14
15 var EXCEPTION_DATA = "String exception";
16 var e;
17 var caught = false;
18
19 printStatus ("Basic catchguard test.");
20
21 try
22 {
23 throw EXCEPTION_DATA;
24 }
25 catch (e if true)
26 {
27 caught = true;
28 }
29 catch (e if true)
30 {
31 reportCompare('PASS', 'FAIL',
32 "Second (e if true) catch block should not have executed.");
33 }
34 catch (e)
35 {
36 reportCompare('PASS', 'FAIL', "Catch block (e) should not have executed.");
37 }
38
39 if (!caught)
40 reportCompare('PASS', 'FAIL', "Exception was never caught.");
41
42 reportCompare('PASS', 'PASS', 'Basic catchguard test');
43
44 exitFunc ("test");
45 }