Debian Codegraph @

js/src/tests/non262/Exceptions/catchguard-003-n.js

raw
1 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*-
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 DESCRIPTION = "Illegally constructed catchguard should have thrown an exception.";
8
9 var expect;
10 var actual;
11
12 test();
13
14 function test()
15 {
16 var EXCEPTION_DATA = "String exception";
17 var e;
18
19 printStatus ("Catchguard syntax negative test #2.");
20
21 try
22 {
23 throw EXCEPTION_DATA;
24 }
25 catch (e)
26 {
27 actual = e + ': 1';
28 }
29 catch (e) /* two non-guarded catch statements should generate an error */
30 {
31 actual = e + ': 2';
32 }
33
34 reportCompare(expect, actual, DESCRIPTION);
35 }