##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	1995/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite testsequence
#   Command:		load
#   Modulefiles:	prereq/module, trace/all_on, trace/all_off
#   Sub-Command:
#
#   Comment:	%C{
#			Tests the 'prereq' command using a category
#			module name. This tests the reactions of modulecmd
#			if the prerequired module is not load and if one
#			of the modules of the required category is load.
#		}C%
#
##############################################################################

#
#  Variables. This test forces a module load command. It will result in the
#    environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to
#    be set up
#

set module "prereq/module"
set modulefile "$env(MODULEPATH)/$module"

set module_tron "trace/all_on"
set modulefile_tron "$env(MODULEPATH)/$module_tron"

set module_troff "trace/all_off"
set modulefile_troff "$env(MODULEPATH)/$module_troff"

#
#  Only for the csh
#

set lmf_csh_tron "setenv _LMFILES_ $modulefile_tron:$modulefile ;"
set lm_csh_tron "setenv LOADEDMODULES $module_tron:$module ;"
set lmf_csh_troff "setenv _LMFILES_ $modulefile_troff:$modulefile ;"
set lm_csh_troff "setenv LOADEDMODULES $module_troff:$module ;"

set ts_csh "setenv testsuite yes ;"

#
#  Error messages
#

set err_prereq "$error_msgs: Module '$module' depends on one of the module\\(s\\) 'trace/load_ovr trace/load_onoff trace/load_on trace/load_all2 trace/load_all1 trace/disptrac trace/disp_onoff trace/dilo_onoff trace/colon trace/all_on trace/all_off'\n"
set err_exec "$error_msgs: Tcl command execution failed: prereq\ttrace\n"

#
#  The tests
#

testerr_cmd_re "csh" "load $module" "$err_prereq$err_exec"
test_cmd "csh" "load $module_troff $module" "$lm_csh_troff$lmf_csh_troff$ts_csh"
test_cmd "csh" "load $module_tron $module" "$lm_csh_tron$lmf_csh_tron$ts_csh"

#
#  Cleanup
#

unset err_prereq
unset err_exec

unset ts_csh

unset lm_csh_troff
unset lmf_csh_troff
unset lm_csh_tron
unset lmf_csh_tron

unset modulefile
unset module
unset modulefile_tron
unset module_tron
unset modulefile_troff
unset module_troff
