# Procedure.test --
#
#	Tests the implementation of the Procedure.java file.
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# SCCS: @(#) Procedure.test 1.2 98/01/14 16:38:59

# FIXME: These are sort of like tests in proc-old.test
# they should be merged, we don't need this extra test file.

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import -force ::tcltest::*
}

setupJavaPackage

test Procedure-1.1 {Procedure.cmdProc, use of Interp.updateReturnInfo} {
    proc foo {} {
	return -code ok
    }
    list [catch {foo} msg] $msg
} {0 {}}

test Procedure-1.2 {Procedure.cmdProc, use of Interp.updateReturnInfo} {
    proc foo {} {
	return -code return
    }
    list [catch {foo} msg] $msg
} {2 {}}

test Procedure-1.3 {Procedure.cmdProc, use of Interp.updateReturnInfo} {
    proc foo {} {
	return -code error baz
    }
    list [catch {foo} msg] $msg
} {1 baz}

test Procedure-1.4 {Procedure.cmdProc, use of Interp.updateReturnInfo} {
    proc foo {} {
	return -code break baz
    }
    list [catch {foo} msg] $msg
} {3 baz}

test Procedure-1.5 {Procedure.cmdProc} {
    proc foo {} {
	error bar
    }
    list [catch {foo} msg] $msg
} {1 bar}

test Procedure-1.6 {Procedure.cmdProc} {
    proc foo {} {
	break
    }
    list [catch {foo} msg] $msg
} {1 {invoked "break" outside of a loop}}

test Procedure-1.7 {Procedure.cmdProc} {
    proc foo {} {
	continue
    }
    list [catch {foo} msg] $msg
} {1 {invoked "continue" outside of a loop}}

# cleanup
::tcltest::cleanupTests
return
