##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	2006/02/21
#   Last Mod.:		%U%, %G%
#
#   Authors:		R.K. Owen, <rk@owen.sj.ca.us>
#
#   Description:	Testuite testsequence
#   Command:		load
#   Modulefiles:	break/4.0,
#   			continue/4.0,
#   Sub-Command:
#
#   Comment:	%C{
#			Tries the Tcl "break" and "continue" used in
#			a valid loop
#		}C%
#
##############################################################################

set break4 "break/4.0"
set cont4 "continue/4.0"

set break4p "$env(MODULEPATH)/$break4"
set cont4p "$env(MODULEPATH)/$cont4"

#
# set up an empty environment
#
set module ""
set modulefile ""
set env(_LMFILES_) "$modulefile"
set env(LOADEDMODULES) "$module"

#
#  load (break)
#  For the different shells ...
#
set module "$break4"
set modulefile "$break4p"

set lmf_sh "_LMFILES_=$modulefile ;export _LMFILES_;"
set lm_sh "LOADEDMODULES=$module ;export LOADEDMODULES;"
set ts_sh4 "testsuite4=9 ;export testsuite4;"

set lmf_csh "setenv _LMFILES_ $modulefile ;"
set lm_csh "setenv LOADEDMODULES $module ;"
set ts_csh4 "setenv testsuite4 9 ;"

set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile';"
set lm_perl "\$ENV{'LOADEDMODULES'} = '$module';"
set ts_perl4 "\$ENV{'testsuite4'} = '9';"

set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile\")"
set lm_cmake "set(ENV{LOADEDMODULES} \"$module\")"
set ts_cmake4 "set(ENV{testsuite4} \"9\")"

#
#  The tests
#
test_cmd "sh" "load $break4" "$lm_sh$lmf_sh$ts_sh4"
test_cmd "ksh" "load $break4" "$lm_sh$lmf_sh$ts_sh4"
test_cmd "zsh" "load $break4" "$lm_sh$lmf_sh$ts_sh4"
test_cmd "csh" "load $break4" "$lm_csh$lmf_csh$ts_csh4"
test_cmd "tcsh" "load $break4" "$lm_csh$lmf_csh$ts_csh4"
test_cmd "perl" "load $break4" "$lm_perl$lmf_perl$ts_perl4"
test_cmd "cmake" "load $break4" "$lm_cmake\n$lmf_cmake\n$ts_cmake4"

#
#  load (continue)
#  For the different shells ...
#
set module "$cont4"
set modulefile "$cont4p"

set lmf_sh "_LMFILES_=$modulefile ;export _LMFILES_;"
set lm_sh "LOADEDMODULES=$module ;export LOADEDMODULES;"
set ts_sh4 "testsuite4=9 ;export testsuite4;"

set lmf_csh "setenv _LMFILES_ $modulefile ;"
set lm_csh "setenv LOADEDMODULES $module ;"
set ts_csh4 "setenv testsuite4 9 ;"

set lmf_perl "\$ENV{'_LMFILES_'} = '$modulefile';"
set lm_perl "\$ENV{'LOADEDMODULES'} = '$module';"
set ts_perl4 "\$ENV{'testsuite4'} = '9';"

set lmf_cmake "set(ENV{_LMFILES_} \"$modulefile\")"
set lm_cmake "set(ENV{LOADEDMODULES} \"$module\")"
set ts_cmake4 "set(ENV{testsuite4} \"9\")"

#
#  The tests
#
test_cmd "sh" "load $cont4" "$lm_sh$lmf_sh$ts_sh4"
test_cmd "ksh" "load $cont4" "$lm_sh$lmf_sh$ts_sh4"
test_cmd "zsh" "load $cont4" "$lm_sh$lmf_sh$ts_sh4"
test_cmd "csh" "load $cont4" "$lm_csh$lmf_csh$ts_csh4"
test_cmd "tcsh" "load $cont4" "$lm_csh$lmf_csh$ts_csh4"
test_cmd "perl" "load $cont4" "$lm_perl$lmf_perl$ts_perl4"
test_cmd "cmake" "load $cont4" "$lm_cmake\n$lmf_cmake\n$ts_cmake4"

#
#  Cleanup
#

unset env(_LMFILES_)
unset env(LOADEDMODULES)

unset lm_sh
unset lmf_sh
unset ts_sh4

unset lm_csh
unset lmf_csh
unset ts_csh4

unset lm_perl
unset lmf_perl
unset ts_perl4

unset lm_cmake
unset lmf_cmake
unset ts_cmake4

unset modulefile
unset module

unset break4
unset cont4
unset break4p
unset cont4p

