mirror of
https://github.com/envmodules/modules.git
synced 2026-06-10 00:56:30 +08:00
87 lines
2.3 KiB
Plaintext
87 lines
2.3 KiB
Plaintext
##############################################################################
|
|
# Modules Revision 3.0
|
|
# Providing a flexible user environment
|
|
#
|
|
# File: modules.50-cmds/%M%
|
|
# Revision: %I%
|
|
# First Edition: 2018/10/14
|
|
# Last Mod.: %U%, %G%
|
|
#
|
|
# Authors: nanobowers <nanobowers@gmail.com>
|
|
#
|
|
# Description: Testsuite testsequence
|
|
# Command: unload
|
|
# Modulefiles: function/1.0
|
|
# Sub-Command:
|
|
#
|
|
# Comment: %C{
|
|
# Tests the reverse 'set-function' module subcommand
|
|
# for all allowed shell types.
|
|
# }C%
|
|
#
|
|
##############################################################################
|
|
|
|
#
|
|
# Variables. This test forces a module unload command. It will result in the
|
|
# environment variables "_LMFILES_", "LOADEDMODULES" and "testsuite" to
|
|
# be set up
|
|
#
|
|
|
|
set module "function/1.0"
|
|
set modulefile "$modpath/$module"
|
|
|
|
#
|
|
# Set up the environment for reversal ...
|
|
#
|
|
|
|
setenv_loaded_module $module $modulefile
|
|
setenv_var __MODULES_LMREFRESH $module
|
|
|
|
#
|
|
# Expected results for the different shells ...
|
|
#
|
|
set ans_fish [list]
|
|
lappend ans_fish [list unset _LMFILES_]
|
|
lappend ans_fish [list unset LOADEDMODULES]
|
|
lappend ans_fish [list unset __MODULES_LMREFRESH]
|
|
lappend ans_fish [list "functions -e testsuite2;"]
|
|
lappend ans_fish [list "functions -e testsuite3;"]
|
|
lappend ans_fish [list "functions -e testsuite4;"]
|
|
lappend ans_fish [list "functions -e testsuite;"]
|
|
lappend ans_fish [list "functions -e testsuite5;"]
|
|
|
|
set ans_sh [list]
|
|
lappend ans_sh [list unset _LMFILES_]
|
|
lappend ans_sh [list unset LOADEDMODULES]
|
|
lappend ans_sh [list unset __MODULES_LMREFRESH]
|
|
lappend ans_sh [list "unset -f testsuite2;"]
|
|
lappend ans_sh [list "unset -f testsuite3;"]
|
|
lappend ans_sh [list "unset -f testsuite4;"]
|
|
lappend ans_sh [list "unset -f testsuite;"]
|
|
lappend ans_sh [list "unset -f testsuite5;"]
|
|
|
|
set ans_empty [list]
|
|
lappend ans_empty [list unset _LMFILES_]
|
|
lappend ans_empty [list unset LOADEDMODULES]
|
|
lappend ans_empty [list unset __MODULES_LMREFRESH]
|
|
|
|
#
|
|
# The tests
|
|
#
|
|
foreach sh $supported_shells {
|
|
# Can only sh/bash actually unset functions?
|
|
if { [lsearch {sh bash zsh ksh} $sh] >= 0 } {
|
|
test_cmd "$sh" "unload $module" $ans_sh
|
|
} elseif { $sh == "fish" } {
|
|
test_cmd "$sh" "unload $module" $ans_fish
|
|
} else {
|
|
test_cmd "$sh" "unload $module" $ans_empty
|
|
}
|
|
}
|
|
|
|
#
|
|
# Cleanup
|
|
#
|
|
|
|
reset_test_env
|