# 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.
#
# RCS: @(#) $Id: Procedure.test,v 1.1 1998/11/05 19:48:41 hylands Exp $


# Note: This test file must be sourced from the parent directory
#       or else the defs file may not be properly loaded.

if {[string compare test [info procs test]] == 1} then {source defs}

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}}

