##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.30-userlvl/%M%
#   Revision:		%I%
#   First Edition:	95/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite testsequence
#   Command:		load
#   Modulefiles:	loc_sym/alias4, user/nov
#   Sub-Command:
#
#   Comment:	%C{
#			Checks the reaction to duplicate module aliases for
#			the userlevel 'novice' starting at all possible user
#			levels
#		}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 mod_alias4 "loc_sym/alias4"
set modfil_alias4 "$env(MODULEPATH)/$mod_alias4"

set module_1 "user/nov"
set modulefile_1 "$env(MODULEPATH)/$module_1"

#
#  'alias4' will behave different depending on user levels ..
#

set warn_dup "$warn_msgs: Duplicate alias 'foo' found"
set err_dup "$error_msgs: Tcl command execution failed: module-alias.*"

#
#
#  Only checked for the csh
#

set lmf_csh_1 "setenv _LMFILES_ '$modulefile_1:$modfil_alias4';"
set lm_csh_1 "setenv LOADEDMODULES '$module_1:$mod_alias4';"
set ts_csh_1_nov "$warn_dup.*$err_dup"
set ts_csh_1_adv "setenv testsuite 'loc_sym/2.0';.*$warn_dup"
set ts_csh_1_exp "setenv testsuite 'loc_sym/2.0';"

#
#  The tests
#

testerr_cmd_re "csh" "-u nov load $module_1 $mod_alias4" "$ts_csh_1_nov"
testerr_cmd_re "csh" "-u adv load $module_1 $mod_alias4" "$ts_csh_1_nov"
testerr_cmd_re "csh" "-u exp load $module_1 $mod_alias4" "$ts_csh_1_nov"

#
#  Cleanup
#

unset warn_dup
unset err_dup

unset ts_csh_1_nov
unset ts_csh_1_adv
unset ts_csh_1_exp
unset lm_csh_1
unset lmf_csh_1

unset modulefile_1
unset module_1

unset mod_alias4
unset modfil_alias4
