##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	2001/06/20
#   Last Mod.:		%U%, %G%
#
#   Authors:		R.K. Owen,  rk@owen.sj.ca.us
#
#   Description:	Testuite testsequence
#   Command:		load & unload
#   Modulefiles:	versions/1.1, versions/1.2, versions/1.3
#   Sub-Command:
#
#   Comment:	%C{
#			Tests the module versioning capability.
#			specifically the unloading of a version.
#		}C%
#
##############################################################################

if { $verbose > 0 } {
	send_user "\tUnload of version on a tall stack ...\n"
}

set env(MODULE_VERSION) "$version3"
set env(MODULE_VERSION_STACK) "$module_version_stack3"
setenv_loaded_module [list $module1 $module2 $module3] [list $modulefile1 $modulefile2 $modulefile3]

#
#  For the different shells ...
#

lappend ans [list setpath MODULE_VERSION_STACK $module_version_stack2]
lappend ans [list setpath LOADEDMODULES "$module1:$module2"]
lappend ans [list setpath _LMFILES_ "$modulefile1:$modulefile2"]
lappend ans [list set MODULE_VERSION $version2]


#
#  The tests
#

test_cmd_re "ALL" "unload $module3" $ans

#
# Remove a version that is not on top of the stack
#
#  For the different shells ...
#

set ans [list]
lappend ans [list setpath MODULE_VERSION_STACK "$version3:$version1"]
lappend ans [list setpath LOADEDMODULES "$module1:$module3"]
lappend ans [list setpath _LMFILES_ "$modulefile1:$modulefile3"]
lappend ans [list set MODULE_VERSION $version3]

#
#  The tests
#

# different behavior than C-version: on Tcl-version env variable value is
# set even if its current value does change
test_cmd_re "ALL" "unload $module2" $ans

#
#  Cleanup
#

reset_test_env
