##############################################################################
#   Modules Revision 3.2.8
#   Providing a flexible user environment
#
#   First Edition:	2010/09/13
#
#   Authors:		R.K. Owen, rk@owen.sj.ca.us
#
#   Description:	Deep modulefile directories - load
#
##############################################################################

# ensure auto symbolic versions are not set for these tests
setenv_var MODULES_ADVANCED_VERSION_SPEC 0

set p		"$modpath/"

lappend ans [list set TEST $oplain0]
lappend ans [list setpath LOADEDMODULES $oplain0]
lappend ans [list setpath _LMFILES_ "$p$oplain0"]
lappend ans [list setpath MODULES_LMCONFLICT "$oplain0&$iplain0/dir2"]
test_cmd_re "csh" "load $iplain0" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $oplain1]
lappend ans [list setpath LOADEDMODULES $oplain1]
lappend ans [list setpath _LMFILES_ "$p$oplain1"]
lappend ans [list setpath MODULES_LMCONFLICT "$oplain1&$iplain1"]
test_cmd_re "csh" "load $iplain1" [if_implicitdefault $ans ERR]


set ans [list]
lappend ans [list set TEST $omodulerc0]
lappend ans [list setpath LOADEDMODULES $omodulerc0]
lappend ans [list setpath _LMFILES_ "$p$omodulerc0"]
lappend ans [list setpath MODULES_LMCONFLICT "$omodulerc0&$cmodulerc"]
lappend ans [list setpath MODULES_LMALTNAME $omodulerc0alt]
test_cmd_re "csh" "load $imodulerc0" $ans

set ans [list]
lappend ans [list set TEST $omodulerc1]
lappend ans [list setpath LOADEDMODULES $omodulerc1]
lappend ans [list setpath _LMFILES_ "$p$omodulerc1"]
lappend ans [list setpath MODULES_LMCONFLICT "$omodulerc1&$cmodulerc"]
lappend ans [list setpath MODULES_LMALTNAME $omodulerc1alt]
test_cmd_re "csh" "load $imodulerc1" $ans

set ans [list]
lappend ans [list set TEST $omodulerc2]
lappend ans [list setpath LOADEDMODULES $omodulerc2]
lappend ans [list setpath _LMFILES_ "$p$omodulerc2"]
lappend ans [list setpath MODULES_LMCONFLICT "$omodulerc2&$cmodulerc"]
test_cmd_re "csh" "load $imodulerc2" $ans


set ans [list]
lappend ans [list set TEST $oversion0]
lappend ans [list setpath LOADEDMODULES $oversion0]
lappend ans [list setpath _LMFILES_ "$p$oversion0"]
lappend ans [list setpath MODULES_LMCONFLICT "$oversion0&$cversion"]
lappend ans [list setpath MODULES_LMALTNAME $oversion0alt]
test_cmd_re "csh" "load $iversion0" $ans

set ans [list]
lappend ans [list set TEST $oversion1]
lappend ans [list setpath LOADEDMODULES $oversion1]
lappend ans [list setpath _LMFILES_ "$p$oversion1"]
lappend ans [list setpath MODULES_LMCONFLICT "$oversion1&$cversion"]
lappend ans [list setpath MODULES_LMALTNAME $oversion1alt]
test_cmd_re "csh" "load $iversion1" $ans

set ans [list]
lappend ans [list set TEST $oversion2]
lappend ans [list setpath LOADEDMODULES $oversion2]
lappend ans [list setpath _LMFILES_ "$p$oversion2"]
lappend ans [list setpath MODULES_LMCONFLICT "$oversion2&$cversion"]
test_cmd_re "csh" "load $iversion2" $ans


set ans [list]
lappend ans [list set TESTD $rload0]
lappend ans [list setpath LOADEDMODULES "$rload0:$oload0"]
lappend ans [list setpath _LMFILES_ "$p$rload0:$p$oload0"]
lappend ans [list set TEST $oload0]
lappend ans [list set TESTDS $rsload0]
lappend ans [list setpath MODULES_LMCONFLICT "$rload0&dir2:$oload0&$cload"]
lappend ans [list setpath MODULES_LMALTNAME "$rload0alt:$oload0alt"]
lappend ans [list setpath MODULES_LMPREREQ "$oload0&$rload0"]
lappend ans [list set TESTS $osload0]
lappend ans [list setpath MODULES_LMNOTUASKED "$rload0"]
test_cmd_re "csh" "load $iload0" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TESTD $rload1]
lappend ans [list setpath LOADEDMODULES "$rload1:$oload1"]
lappend ans [list setpath _LMFILES_ "$p$rload1:$p$oload1"]
lappend ans [list set TEST $oload1]
lappend ans [list set TESTDS $rsload1]
lappend ans [list setpath MODULES_LMCONFLICT "$rload1&dir2:$oload1&$cload"]
lappend ans [list setpath MODULES_LMALTNAME "$rload1alt:$oload1alt"]
lappend ans [list setpath MODULES_LMPREREQ "$oload1&$rload1"]
lappend ans [list set TESTS $osload1]
lappend ans [list setpath MODULES_LMNOTUASKED "$rload1"]
test_cmd_re "csh" "load $iload1" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TESTD $rload2]
lappend ans [list setpath LOADEDMODULES "$rload2:$oload2"]
lappend ans [list setpath _LMFILES_ "$p$rload2:$p$oload2"]
lappend ans [list set TEST $oload2]
lappend ans [list set TESTDS $rsload2]
lappend ans [list setpath MODULES_LMCONFLICT "$rload2&dir2:$oload2&$cload"]
lappend ans [list setpath MODULES_LMALTNAME "$rload2alt:$oload2alt"]
lappend ans [list setpath MODULES_LMPREREQ "$oload2&$rload2"]
lappend ans [list set TESTS $osload2]
lappend ans [list setpath MODULES_LMNOTUASKED "$rload2"]
test_cmd_re "csh" "load $iload2" $ans


set ans [list]
lappend ans [list set TEST $oalias0]
lappend ans [list setpath LOADEDMODULES $oalias0]
lappend ans [list setpath _LMFILES_ "$p$oalias0"]
lappend ans [list setpath MODULES_LMCONFLICT "$oalias0&$calias"]
lappend ans [list setpath MODULES_LMALTNAME $oalias0alt]
test_cmd_re "csh" "load $ialias0" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $oalias1]
lappend ans [list setpath LOADEDMODULES $oalias1]
lappend ans [list setpath _LMFILES_ "$p$oalias1"]
lappend ans [list setpath MODULES_LMCONFLICT "$oalias1&$calias"]
lappend ans [list setpath MODULES_LMALTNAME $oalias1alt]
test_cmd_re "csh" "load $ialias1" $ans

set ans [list]
lappend ans [list set TEST $oalias2]
lappend ans [list setpath LOADEDMODULES $oalias2]
lappend ans [list setpath _LMFILES_ "$p$oalias2"]
lappend ans [list setpath MODULES_LMCONFLICT "$oalias2&$calias"]
lappend ans [list setpath MODULES_LMALTNAME $oalias2alt]
test_cmd_re "csh" "load $ialias2" $ans

set ans [list]
lappend ans [list set TEST $oalias3]
lappend ans [list setpath LOADEDMODULES $oalias3]
lappend ans [list setpath _LMFILES_ "$p$oalias3"]
lappend ans [list setpath MODULES_LMCONFLICT "$oalias3&$calias"]
lappend ans [list setpath MODULES_LMALTNAME $oalias3alt]
test_cmd_re "csh" "load $ialias3" $ans


set ans [list]
lappend ans [list set TEST $osym0]
lappend ans [list setpath LOADEDMODULES $osym0]
lappend ans [list setpath _LMFILES_ "$p$osym0"]
lappend ans [list setpath MODULES_LMCONFLICT "$osym0&$csym"]
lappend ans [list setpath MODULES_LMALTNAME $osym0alt]
test_cmd_re "csh" "load $isym0" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $osym1]
lappend ans [list setpath LOADEDMODULES $osym1]
lappend ans [list setpath _LMFILES_ "$p$osym1"]
lappend ans [list setpath MODULES_LMCONFLICT "$osym1&$csym"]
lappend ans [list setpath MODULES_LMALTNAME $osym1alt]
test_cmd_re "csh" "load $isym1" $ans

set ans [list]
lappend ans [list set TEST $osym2]
lappend ans [list setpath LOADEDMODULES $osym2]
lappend ans [list setpath _LMFILES_ "$p$osym2"]
lappend ans [list setpath MODULES_LMCONFLICT "$osym2&$csym"]
lappend ans [list setpath MODULES_LMALTNAME $osym2alt]
test_cmd_re "csh" "load $isym2" $ans


set ans [list]
lappend ans [list set TEST $ovirt0]
lappend ans [list setpath LOADEDMODULES $ovirt0]
lappend ans [list setpath _LMFILES_ "$pvirt"]
lappend ans [list setpath MODULES_LMALTNAME $ovirt0alt]
test_cmd_re "csh" "load $ivirt0" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $ovirt1]
lappend ans [list setpath LOADEDMODULES $ovirt1]
lappend ans [list setpath _LMFILES_ "$pvirt"]
lappend ans [list setpath MODULES_LMALTNAME $ovirt1alt]
test_cmd_re "csh" "load $ivirt1" $ans

set ans [list]
lappend ans [list set TEST $ovirt2]
lappend ans [list setpath LOADEDMODULES $ovirt2]
lappend ans [list setpath _LMFILES_ "$pvirt"]
lappend ans [list setpath MODULES_LMALTNAME $ovirt2alt]
test_cmd_re "csh" "load $ivirt2" $ans

set ans [list]
lappend ans [list set TEST $ovirt3]
lappend ans [list setpath LOADEDMODULES $ovirt3]
lappend ans [list setpath _LMFILES_ "$pvirt"]
lappend ans [list setpath MODULES_LMALTNAME $ovirt3alt]
test_cmd_re "csh" "load $ivirt3" $ans

set ans [list]
lappend ans [list set TEST $ovirt4]
lappend ans [list setpath LOADEDMODULES $ovirt4]
lappend ans [list setpath _LMFILES_ "$pvirt"]
lappend ans [list setpath MODULES_LMALTNAME $ovirt4alt]
test_cmd_re "csh" "load $ivirt4" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $ovirt5]
lappend ans [list setpath LOADEDMODULES $ovirt5]
lappend ans [list setpath _LMFILES_ "$pvirt"]
lappend ans [list setpath MODULES_LMALTNAME $ovirt5alt]
test_cmd_re "csh" "load $ivirt5" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $ovirt6]
lappend ans [list setpath LOADEDMODULES $ovirt6]
lappend ans [list setpath _LMFILES_ "$pvirt"]
test_cmd_re "csh" "load $ivirt6" $ans

set ans [list]
lappend ans [list set TEST $ovirt7]
lappend ans [list setpath LOADEDMODULES $ovirt7]
lappend ans [list setpath _LMFILES_ "$pvirt"]
test_cmd_re "csh" "load $ivirt7" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list set TEST $ovirt8]
lappend ans [list setpath LOADEDMODULES $ovirt8]
lappend ans [list setpath _LMFILES_ "$pvirt"]
test_cmd_re "csh" "load $ivirt8" [if_implicitdefault $ans ERR]


set ans [list]
lappend ans [list setpath LOADEDMODULES $odalias0]
lappend ans [list setpath _LMFILES_ "$p$odalias0"]
lappend ans [list setpath MODULES_LMALTNAME $odalias0alt]
test_cmd_re "csh" "load $idalias0" [if_implicitdefault $ans ERR]

set ans [list]
lappend ans [list setpath LOADEDMODULES $odalias1]
lappend ans [list setpath _LMFILES_ "$p$odalias1"]
lappend ans [list setpath MODULES_LMALTNAME $odalias1alt]
test_cmd_re "csh" "load $idalias1" [if_implicitdefault $ans ERR]


set ans [list]
lappend ans [list setpath LOADEDMODULES $obadvers0]
lappend ans [list setpath _LMFILES_ "$p$obadvers0"]
lappend ans [list ERR]
testouterr_cmd_re "csh" "load $ibadvers0" [if_implicitdefault $ans ERR] "$error_msgs: Invalid ModulesVersion 'dir1/2.0' defined[if_implicitdefault {} \n$err_nodefault'$ibadvers0']"

set ans [list]
lappend ans [list setpath LOADEDMODULES $obadvers1]
lappend ans [list setpath _LMFILES_ "$p$obadvers1"]
lappend ans [list ERR]
testouterr_cmd_re "csh" "load $ibadvers1" [if_implicitdefault $ans ERR] "$error_msgs: Invalid ModulesVersion 'dir1/2.0' defined[if_implicitdefault {} \n$err_nodefault'$ibadvers1']"


reset_test_env
