##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.10-use/%M%
#   Revision:		%I%
#   First Edition:	95/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite testsequence
#   Command:		use -append
#   Sub-Command:
#
#   Comment:	%C{
#			Check appending a new path to the current lists of
#			module paths.
#		}C%
#
##############################################################################

#
# Variables for this test
#

set path "$env(TESTSUITEDIR)/modulefiles.other"
set badpath "$env(TESTSUITEDIR)/modulefiles.bad"
set mod_path "$env(MODULEPATH):$path"
set bad_use "$error_msgs: Directory '$badpath' not found"

set use	"use --append"

#
# The tests ...
#

test_cmd "sh" "$use $path" "MODULEPATH=$mod_path ;export MODULEPATH;"
test_cmd "ksh" "$use $path" "MODULEPATH=$mod_path ;export MODULEPATH;"
test_cmd "zsh" "$use $path" "MODULEPATH=$mod_path ;export MODULEPATH;"
test_cmd "csh" "$use $path" "setenv MODULEPATH $mod_path ;"
test_cmd "tcsh" "$use $path" "setenv MODULEPATH $mod_path ;"
test_cmd "perl" "$use $path" "\$ENV{'MODULEPATH'} = '$mod_path';"
test_cmd "cmake" "$use $path" "set(ENV{MODULEPATH} \"$mod_path\")"

#
# test if use non-existent modulefile directory
#

testerr_cmd_re "sh" "$use $badpath" "$bad_use"
testerr_cmd_re "ksh" "$use $badpath" "$bad_use"
testerr_cmd_re "zsh" "$use $badpath" "$bad_use"
testerr_cmd_re "csh" "$use $badpath" "$bad_use"
testerr_cmd_re "tcsh" "$use $badpath" "$bad_use"
testerr_cmd_re "perl" "$use $badpath" "$bad_use"
testerr_cmd_re "cmake" "$use $badpath" "$bad_use"

#
# Cleanup
#

unset path
unset mod_path
unset use
unset badpath
unset bad_use
