##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.00-init/%M%
#   Revision:		%I%
#   First Edition:	1995/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite testsequence
#   Command:
#   Sub-Command:
#
#   Comment:	%C{
#			Checks the uninitialized modulecmd. This should
#			result in the setup of the starting-environment
#			$env(HOME)/.modulesbeginenv
#		}C%
#
##############################################################################

#
# The following answers are to be expected in this testcase ...
#

set beg_env "$env(TESTSUITEDIR)/.modulesbeginenv"
set beg_envx "$env(TESTSUITEDIR)/.modulesbeginenv.xxx"
set env(HOME) $env(TESTSUITEDIR)
set ORIG_HOME $env(HOME)

#
# The tests ...
#

set ans [list]
if { [ version_test "BEGINENV=1" ] } {
lappend ans [list set _MODULESBEGINENV_ $beg_env]
testouterr_cmd "sh" "--long list" $ans "$no_loaded"
} elseif { [ version_test "BEGINENV=99" ] } {
testouterr_cmd_re "sh" "update" "" \
		".*Invalid update subcommand - No MODULESBEGINENV.*"

# set this here
	set env(MODULESBEGINENV) $beg_envx

lappend ans [list set _MODULESBEGINENV_ $beg_envx]
testouterr_cmd "sh" "--long list" $ans "$no_loaded"
} else {
	send_user "skipping .modulesbeginenv tests\n"
}

#
# Finally set up the _MODULESBEGINENV_ environment variable for all
# further tests
#

if { [ version_test "BEGINENV=99" ] } {
	set env(_MODULESBEGINENV_) $beg_envx
} elseif { [ version_test "BEGINENV=1" ] } {
	set env(_MODULESBEGINENV_) $beg_env
}

#
# Cleanup
#

unset beg_env
unset beg_envx
unset ans
