Debian Codegraph @

testsuite/modules.70-maint/100-path.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.70-maint/%M%
6 # Revision: %I%
7 # First Edition: 2017/05/18
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command: path
14 # Modulefiles: averssort
15 # Sub-Command:
16 #
17 # Comment: %C{
18 # Tests the module command 'path'
19 # }C%
20 #
21 ##############################################################################
22
23 skip_if_quick_mode
24
25 # skip tests if implicit_default option could not be overridden
26 if {[is_config_locked implicit_default]} {
27 send_user "\tskipping tests as implicit_default could not be overridden\n"
28 } else {
29
30 # ensure avail tests have implicit default enabled
31 setenv_var MODULES_IMPLICIT_DEFAULT 1
32
33 #
34 # Test variables
35 #
36
37 set module_1 "averssort"
38 set modulefile_1 "$modpath/verssort/1.10"
39 set module_2 "foo"
40 set err_locmod "$err_path'$module_2'"
41
42
43 #
44 # test with a modulefile to resolve
45 #
46
47 lappend ans [list text $modulefile_1]
48 testouterr_cmd "ALL" "path $module_1" $ans ""
49
50 # setup MODULEPATH with a trailing slash and an empty dir element
51 setenv_path_var MODULEPATH {} "$modpath/"
52 testouterr_cmd "sh" "path $module_1" $ans ""
53
54 # restore MODULEPATH
55 setenv_path_var MODULEPATH $modpath
56
57 #
58 # test with nonexistent modulefile
59 #
60
61 set ans [list]
62 lappend ans [list text ""]
63 testouterr_cmd "ALL" "path $module_2" $ans $err_locmod
64
65 #
66 # check error when implicit default is disabled
67 #
68
69 setenv_var MODULES_IMPLICIT_DEFAULT 0
70 testouterr_cmd sh "path $module_1" $ans "$err_nodefault'$module_1'"
71 setenv_var MODULES_IMPLICIT_DEFAULT 1
72
73
74 #
75 # Cleanup
76 #
77
78 reset_test_env
79
80 }