try.js revision 6:5a1b0714df0e
190075Sobrien/* 2169689Skan * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 390075Sobrien * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 490075Sobrien * 590075Sobrien * This code is free software; you can redistribute it and/or modify it 690075Sobrien * under the terms of the GNU General Public License version 2 only, as 790075Sobrien * published by the Free Software Foundation. 890075Sobrien * 990075Sobrien * This code is distributed in the hope that it will be useful, but WITHOUT 1090075Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1190075Sobrien * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1290075Sobrien * version 2 for more details (a copy is included in the LICENSE file that 1390075Sobrien * accompanied this code). 1490075Sobrien * 1590075Sobrien * You should have received a copy of the GNU General Public License version 1690075Sobrien * 2 along with this work; if not, write to the Free Software Foundation, 1790075Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18169689Skan * 19169689Skan * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2090075Sobrien * or visit www.oracle.com if you need additional information or have any 2190075Sobrien * questions. 2290075Sobrien */ 23132718Skan 24132718Skan/** 2590075Sobrien * Try throw test. 2690075Sobrien * 27169689Skan * @test 28169689Skan * @run 2990075Sobrien */ 30117395Skan 31132718Skanfunction A() { 32132718Skan print("before try"); 33169689Skan 34169689Skan try { 3590075Sobrien print("before throw"); 36117395Skan throw "a string"; 37117395Skan } catch (ex) { 38117395Skan print("catch"); 39117395Skan print(ex); 40169689Skan return "correct"; 41169689Skan } finally { 42169689Skan print("finally"); 43132718Skan } 44132718Skan 45169689Skan return "incorrect"; 46132718Skan} 47132718Skan 48132718Skanprint(A()); 4990075Sobrien 5090075Sobrienprint("done"); 5190075Sobrien