trycatch.js revision 2:da1e581c933b
1185029Spjd/*
2185029Spjd * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
3325175Simp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4325175Simp *
5306751Sallanjude * This code is free software; you can redistribute it and/or modify it
6306751Sallanjude * under the terms of the GNU General Public License version 2 only, as
7325094Simp * published by the Free Software Foundation.
8304321Stsoome *
9325694Simp * This code is distributed in the hope that it will be useful, but WITHOUT
10325094Simp * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11325094Simp * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12185029Spjd * version 2 for more details (a copy is included in the LICENSE file that
13185029Spjd * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24/**
25 * try catch test.
26 *
27 * @test
28 * @run
29 */
30
31var actual = '';
32var expect = '';
33
34test();
35
36function test() {
37    expect = true;
38
39    try {
40        actual = true;
41    }
42    catch(ex) {
43        actual = ex + '';
44    }
45
46    print(actual);
47}
48