##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		modules.50-cmds/%M%
#   Revision:		%I%
#   First Edition:	2017/11/28
#   Last Mod.:		%U%, %G%
#
#   Authors:		Xavier Delaruelle, xavier.delaruelle@cea.fr
#
#   Description:	Testuite testsequence
#   Command:		load
#   Modulefiles:	info/isused
#   Sub-Command:
#
#   Comment:	%C{
#			Tests the 'is-used' modulefile subcommand for all
#			allowed shell types.
#		}C%
#
##############################################################################

set module "info/isused"
set modulefile "$modpath/$module"

#
#  The tests
#

lappend ans [list set testsuite1 1]
lappend ans [list set testsuite2 0]
lappend ans [list set testsuite3 0]
lappend ans [list set testsuite4 1]
lappend ans [list set testsuite5 1]
lappend ans [list set testsuite6 1]
lappend ans [list setpath MODULEPATH $modpath]
lappend ans [list setpath LOADEDMODULES $module]
lappend ans [list setpath _LMFILES_ $modulefile]

testouterr_cmd "ALL" "load $module" $ans ""

# empty modulepath
unsetenv_path_var MODULEPATH

set ans [list]
lappend ans [list set testsuite1 0]
lappend ans [list set testsuite2 0]
lappend ans [list set testsuite3 0]
lappend ans [list set testsuite4 0]
lappend ans [list set testsuite5 0]
lappend ans [list set testsuite6 1]
lappend ans [list unsetpath MODULEPATH]
lappend ans [list setpath LOADEDMODULES $modulefile]
lappend ans [list setpath _LMFILES_ $modulefile]

testouterr_cmd "sh" "load $modulefile" $ans ""

#
#  Cleanup
#

reset_test_env
