Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/catchguard-001-n.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-001-n.js';
8
9 DESCRIPTION = " the non-guarded catch should HAVE to appear last";
10 EXPECTED = "error";
11
12 test();
13
14 function test()
15 {
16 enterFunc ("test");
17
18 var EXCEPTION_DATA = "String exception";
19 var e;
20
21 printStatus ("Catchguard syntax negative test.");
22
23 try
24 {
25 throw EXCEPTION_DATA;
26 }
27 catch (e) /* the non-guarded catch should HAVE to appear last */
28 {
29
30 }
31 catch (e if true)
32 {
33
34 }
35 catch (e if false)
36 {
37
38 }
39
40 reportCompare('PASS', 'FAIL',
41 "Illegally constructed catchguard should have thrown " +
42 "an exception.");
43
44 exitFunc ("test");
45 }