############################################################################## # Modules Revision 3.0 # Providing a flexible user environment # # File: modules.50-cmds/%M% # Revision: %I% # First Edition: 1995/12/06 # Last Mod.: %U%, %G% # # Authors: Jens Hamisch, Jens.Hamisch@Strawberry.COM # # Description: Testuite testsequence # Command: unload # Modulefiles: unsetenv/1.0 # Sub-Command: # # Comment: %C{ # Tests the reverse 'unsetenv' module subcommand for all # allowed shell types. # }C% # # Trouble: %T{ # Removal of a 'unsetenv' command *SHOULD* result in # the once removed variable being restored. # # To be discussed: # # - We cannot determine, if the variable really # *HAS BEEN* removed or if it has never been # set up before. # # - We cannot determine, what the former value of # he variable was. # # Should there be a 'default value' in the module # file? This would let us do the following: # # if { [info exists env(tmpvar) ] } { # set saveme $env(tmpvar) # } else { # set saveme "" # } # setenv env(tmpvar) $env(SHELLVARIABLE) # unsetenv SHELLVARIABLE $saveme # }T% # ############################################################################## skip_if_quick_mode # # 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 "unsetenv/1.0" set modulefile "$modpath/$module" # # Set up the environment for reversal ... # if { [info exists env(testsuite)] } { unset env(testsuite) } setenv_loaded_module $module $modulefile # # For the different shells ... # lappend ans [list unset _LMFILES_] lappend ans [list unset LOADEDMODULES] # # The tests # test_cmd "ALL" "unload $module" $ans # # bad specification test # set mp $modpath.3 setenv_path_var MODULEPATH $mp setenv_loaded_module unsetenv/2.0 $mp/unsetenv/2.0 setenv_var TESTSUITE_UNSETENV bad1 unsetenv_var TS1 set ln [expr {[cmpversion $tclsh_version 8.5] < 1 ? {2} : {5}}] set tserr [escre [msg_unload unsetenv/2.0 [msg_moderr {wrong # args: should be "unsetenv ?--noop-on-unload? ?--unset-on-unload? var ?val?"} {unsetenv TS1 foo bar} $mp/unsetenv/2.0 $ln]]] testouterr_cmd_re sh {unload unsetenv/2.0} ERR $tserr setenv_var TS1 foo testouterr_cmd_re sh {unload unsetenv/2.0} ERR $tserr unsetenv_var TS1 unsetenv_var TESTSUITE_UNSETENV unsetenv_loaded_module # # Cleanup # reset_test_env