##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	2005/11/21
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#			R.K.Owen, rk@owen.sj.ca.us
#
#   Description:	Testuite testsequence
#   Command:		refresh
#   Modulefiles:	alias/2.0,setenv/1.0
#   Sub-Command:
#
#   Comment:	%C{
#			Tests the 'refresh' module subcommand for all allowed
#			shell types.
#		}C%
#
##############################################################################

#
#  Variables.
#

set module1 "alias/2.0"
set modulefile1 "$modpath/$module1"
set module2 "setenv/1.0"
set modulefile2 "$modpath/$module2"
set alias "ps -auxww | grep modulecmd"

#
#  Set up the environment for refresh ...
#

setenv_loaded_module $module1 $modulefile1

#
#  For the different shells ...
#

lappend ans [list set _LMFILES__modshare "$modulefile1:1"]
lappend ans [list set LOADEDMODULES_modshare "$module1:1"]
lappend ans [list set _LMFILES_ $modulefile1]
lappend ans [list set LOADEDMODULES $module1]
lappend ans [list alias testsuite $alias]

#
#  The tests
#

# different behavior than C-version: on Tcl-version 'refresh' command is an
# alias on the 'reload' command, thus it unloads then reloads every modules
# currently loaded whereas on C-version, only the volatile components (ie.
# shell aliases) are reloaded.
test_cmd "ALL" "refresh" $ans
# only available for csh/sh/fish derivatives ... no longer warn for others

#
#  Cleanup
#

reset_test_env
