NASHORN-166.js revision 2:da1e581c933b
167760Smsmith/*
267760Smsmith * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
367760Smsmith * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
467760Smsmith *
567760Smsmith * This code is free software; you can redistribute it and/or modify it
667760Smsmith * under the terms of the GNU General Public License version 2 only, as
767760Smsmith * published by the Free Software Foundation.
867760Smsmith *
967760Smsmith * This code is distributed in the hope that it will be useful, but WITHOUT
1067760Smsmith * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1167760Smsmith * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1267760Smsmith * version 2 for more details (a copy is included in the LICENSE file that
1367760Smsmith * accompanied this code).
1467760Smsmith *
1567760Smsmith * You should have received a copy of the GNU General Public License version
1667760Smsmith * 2 along with this work; if not, write to the Free Software Foundation,
1767760Smsmith * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1867760Smsmith *
1967760Smsmith * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2067760Smsmith * or visit www.oracle.com if you need additional information or have any
2167760Smsmith * questions.
2267760Smsmith */
2367760Smsmith
2467760Smsmith/**
2567760Smsmith * NASHORN-166 : Parameter of nested catch should not be shared with enclosing catch.
2667760Smsmith *
2767760Smsmith * @test
2867760Smsmith * @run
2967760Smsmith */
3067760Smsmith
3167760Smsmithtry {
32148318Snjl    throw "ex1";
33148318Snjl} catch(ex){
34148318Snjl    try {
35128226Snjl        throw "ex2";
36128226Snjl    } catch(ex) {
3767760Smsmith    }
38128226Snjl
3967760Smsmith    if (ex !== "ex1") {
4067760Smsmith        fail('#1 expected that (ex === "ex1")');
4167760Smsmith    }
42128226Snjl
4367760Smsmith    if (ex === "ex2") {
4467760Smsmith        fail('#2 expected that (ex !== "ex2")');
4577432Smsmith    }
4691128Smsmith}
4771875Smsmith