===========================
step 1
lua ProjectDIR/src/lmod.in.lua bash --regression_testing --version
===========================
===========================
step 2
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load test1
===========================
LOADEDMODULES=test1/1.0;
export LOADEDMODULES;
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/set_alias/mf:1;
export __LMOD_REF_COUNT_MODULEPATH;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
VARIABLE=1;
export VARIABLE;
_LMFILES_=ProjectDIR/rt/set_alias/mf/test1/1.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={test1={fn="ProjectDIR/rt/set_alias/mf/test1/1.0.lua",fullName="test1/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test1",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
alias rtm_ml=eval\ \$\(\$LMOD_CMD\ bash\ \"\$@\"\);
alias somealias=1;
===========================
step 3
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load test2
===========================
LOADEDMODULES=test2/2.0;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
VARIABLE=2;
export VARIABLE;
_LMFILES_=ProjectDIR/rt/set_alias/mf/test2/2.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={test2={fn="ProjectDIR/rt/set_alias/mf/test2/2.0.lua",fullName="test2/2.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test2",wV="000000002.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
unalias rtm_ml 2> /dev/null || true;
alias somealias=2;
===========================
step 4
lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload test2
===========================
unset LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
unset VARIABLE;
unset _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
unalias somealias 2> /dev/null || true;
===========================
step 5
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load test1
===========================
LOADEDMODULES=test1/1.0;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
VARIABLE=1;
export VARIABLE;
_LMFILES_=ProjectDIR/rt/set_alias/mf/test1/1.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={test1={fn="ProjectDIR/rt/set_alias/mf/test1/1.0.lua",fullName="test1/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test1",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
alias rtm_ml=eval\ \$\(\$LMOD_CMD\ bash\ \"\$@\"\);
alias somealias=1;
===========================
step 6
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load sfunc
===========================
LOADEDMODULES=test1/1.0:sfunc/1.0;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/set_alias/mf/test1/1.0.lua:ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={sfunc={fn="ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua",fullName="sfunc/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="sfunc",wV="000000001.*zfinal",},test1={fn="ProjectDIR/rt/set_alias/mf/test1/1.0.lua",fullName="test1/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test1",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
g++ () { whatever;
};
ml () { eval $($LMOD_DIR/ml_cmd "$@");
};
===========================
step 7
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load alias
===========================
LOADEDMODULES=test1/1.0:sfunc/1.0:alias/1.0;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/set_alias/mf/test1/1.0.lua:ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua:ProjectDIR/rt/set_alias/mf/alias/1.0;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={alias={fn="ProjectDIR/rt/set_alias/mf/alias/1.0",fullName="alias/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="alias",wV="000000001.*zfinal",},sfunc={fn="ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua",fullName="sfunc/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="sfunc",wV="000000001.*zfinal",},test1={fn="ProjectDIR/rt/set_alias/mf/test1/1.0.lua",fullName="test1/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test1",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
alias drmi=docker\ images\ \|\ awk\ \'/\<none\>/\ \{print\ \$3\}\'\ \|\ xargs\ docker\ rmi;
alias module_alias=eval\ \`\$LMOD_DIR/lmod\ bash\ \"\$@\"\`;
===========================
step 8
lua ProjectDIR/src/lmod.in.lua bash --regression_testing load spack
===========================
LOADEDMODULES=test1/1.0:sfunc/1.0:alias/1.0:spack/1.0;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/set_alias/mf/test1/1.0.lua:ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua:ProjectDIR/rt/set_alias/mf/alias/1.0:ProjectDIR/rt/set_alias/mf/spack/1.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={alias={fn="ProjectDIR/rt/set_alias/mf/alias/1.0",fullName="alias/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="alias",wV="000000001.*zfinal",},sfunc={fn="ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua",fullName="sfunc/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="sfunc",wV="000000001.*zfinal",},spack={fn="ProjectDIR/rt/set_alias/mf/spack/1.0.lua",fullName="spack/1.0",loadOrder=4,propT={},stackDepth=0,status="active",userName="spack",wV="000000001.*zfinal",},test1={fn="ProjectDIR/rt/set_alias/mf/test1/1.0.lua",fullName="test1/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test1",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
_some_spack_func () {
   local ARG1=$1;
   if [[ $ARG1 == [a-z]* ]]; then
     echo found;
   fi;
};
===========================
step 9
lua ProjectDIR/src/lmod.in.lua bash --regression_testing show showMe
===========================
MODULEPATH=ProjectDIR/rt/set_alias/mf;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={alias={fn="ProjectDIR/rt/set_alias/mf/alias/1.0",fullName="alias/1.0",loadOrder=3,propT={},stackDepth=0,status="active",userName="alias",wV="000000001.*zfinal",},sfunc={fn="ProjectDIR/rt/set_alias/mf/sfunc/1.0.lua",fullName="sfunc/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="sfunc",wV="000000001.*zfinal",},spack={fn="ProjectDIR/rt/set_alias/mf/spack/1.0.lua",fullName="spack/1.0",loadOrder=4,propT={},stackDepth=0,status="active",userName="spack",wV="000000001.*zfinal",},test1={fn="ProjectDIR/rt/set_alias/mf/test1/1.0.lua",fullName="test1/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="test1",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/set_alias/mf",},systemBaseMPATH="ProjectDIR/rt/set_alias/mf",}';
export _ModuleTable_;
