Skip to content

Commit 44c42fb

Browse files
committed
ts: test module-help modulefile command
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent 5e23508 commit 44c42fb

File tree

5 files changed

+189
-0
lines changed

5 files changed

+189
-0
lines changed

testsuite/example/siteconfig.tcl-1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,4 +686,8 @@ if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_RELEASESTATE)]} {
686686
report [getState modules_release]
687687
}
688688

689+
if {[info exists env(TESTSUITE_ENABLE_SITECONFIG_GETHELPLINES)]} {
690+
report [string length [getModuleHelpLines]]
691+
}
692+
689693
}

testsuite/modulefiles.4/help/1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#%Module
2+
if {[info exists env(TESTSUITE_HELP)]} {
3+
switch -- $env(TESTSUITE_HELP) {
4+
one_string {
5+
module-help {multi word string}
6+
}
7+
multi_arg {
8+
module-help multi word string
9+
}
10+
multi_cmd1 {
11+
module-help {one help line}
12+
module-help {another help line}
13+
}
14+
multi_cmd2 {
15+
module-help {one help line}
16+
module-help {}
17+
module-help {another help line}
18+
module-help {}
19+
}
20+
empty_line {
21+
module-help {}
22+
}
23+
multi_empty_line {
24+
module-help {}
25+
module-help {}
26+
}
27+
with_help_proc1 {
28+
module-help {one help line}
29+
module-help {another help line}
30+
proc ModulesHelp {} {
31+
puts stderr {help line from proc}
32+
}
33+
}
34+
with_help_proc2 {
35+
proc ModulesHelp {} {
36+
puts stderr {help line from proc}
37+
}
38+
module-help {one help line}
39+
module-help {another help line}
40+
}
41+
get_help_lines1 {
42+
module-help {one help line}
43+
module-help {another help line}
44+
puts stderr [join [getModuleHelpLines]]
45+
}
46+
get_help_lines2 {
47+
puts stderr [join [getModuleHelpLines]]
48+
}
49+
}
50+
}

testsuite/modulefiles.4/help/2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#%Module

testsuite/modules.00-init/120-siteconfig.exp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,13 @@ lappend ans $vers_reportre
755755
testouterr_cmd_re sh -V OK [join $ans \n]
756756
unsetenv_var TESTSUITE_ENABLE_SITECONFIG_RELEASESTATE
757757

758+
setenv_var TESTSUITE_ENABLE_SITECONFIG_GETHELPLINES 1
759+
set ans [list]
760+
lappend ans 0
761+
lappend ans $vers_reportre
762+
testouterr_cmd_re sh -V OK [join $ans \n]
763+
unsetenv_var TESTSUITE_ENABLE_SITECONFIG_GETHELPLINES
764+
758765
} elseif {$verbose} {
759766
send_user "\tSkip tests relying on an excepted siteconfig file installed\n"
760767
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
##############################################################################
2+
# Modules Revision 3.0
3+
# Providing a flexible user environment
4+
#
5+
# File: modules.50-cmds/%M%
6+
# Revision: %I%
7+
# First Edition: 2025/03/30
8+
# Last Mod.: %U%, %G%
9+
#
10+
# Authors: Xavier Delaruelle, [email protected]
11+
#
12+
# Description: Testuite testsequence
13+
# Command: help, load, display
14+
# Modulefiles: help
15+
# Sub-Command:
16+
#
17+
# Comment: %C{
18+
# Test module-help command
19+
# }C%
20+
#
21+
##############################################################################
22+
23+
set mp $modpath.4
24+
setenv_var MODULEPATH $mp
25+
26+
27+
setenv_var TESTSUITE_HELP one_string
28+
set tserr "$modlin
29+
Module Specific Help for $modpathre.4/help/1:
30+
31+
multi word string
32+
$modlin"
33+
testouterr_cmd_re bash {help help/1} OK $tserr
34+
35+
setenv_var TESTSUITE_HELP multi_arg
36+
testouterr_cmd_re bash {help help/1} OK $tserr
37+
38+
setenv_var TESTSUITE_HELP multi_cmd1
39+
set tserr "$modlin
40+
Module Specific Help for $modpathre.4/help/1:
41+
42+
one help line
43+
another help line
44+
$modlin"
45+
testouterr_cmd_re bash {help help/1} OK $tserr
46+
47+
skip_if_quick_mode
48+
49+
setenv_var TESTSUITE_HELP multi_cmd2
50+
set tserr "$modlin
51+
Module Specific Help for $modpathre.4/help/1:
52+
53+
one help line
54+
55+
another help line
56+
57+
$modlin"
58+
testouterr_cmd_re bash {help help/1} OK $tserr
59+
60+
set tserr "$modlin
61+
$modpathre.4/help/1:
62+
63+
module-help\t{one help line}
64+
module-help\t{}
65+
module-help\t{another help line}
66+
module-help\t{}
67+
$modlin"
68+
testouterr_cmd_re bash {display help/1} OK $tserr
69+
70+
setenv_var TESTSUITE_HELP empty_line
71+
set tserr "$modlin
72+
Module Specific Help for $modpathre.4/help/1:
73+
74+
75+
$modlin"
76+
testouterr_cmd_re bash {help help/1} OK $tserr
77+
78+
setenv_var TESTSUITE_HELP multi_empty_line
79+
set tserr "$modlin
80+
Module Specific Help for $modpathre.4/help/1:
81+
82+
83+
84+
$modlin"
85+
testouterr_cmd_re bash {help help/1} OK $tserr
86+
87+
setenv_var TESTSUITE_HELP with_help_proc1
88+
set tserr "$modlin
89+
Module Specific Help for $modpathre.4/help/1:
90+
91+
one help line
92+
another help line
93+
help line from proc
94+
$modlin"
95+
testouterr_cmd_re bash {help help/1} OK $tserr
96+
97+
setenv_var TESTSUITE_HELP with_help_proc2
98+
testouterr_cmd_re bash {help help/1} OK $tserr
99+
100+
setenv_var TESTSUITE_HELP get_help_lines1
101+
set ans [list]
102+
lappend ans [list set _LMFILES_ $mp/help/1]
103+
lappend ans [list set LOADEDMODULES help/1]
104+
set tserr "
105+
"
106+
testouterr_cmd_re bash {load help/1} $ans $tserr
107+
108+
set tserr "$modlin
109+
Module Specific Help for $modpathre.4/help/1:
110+
111+
one help line another help line
112+
one help line
113+
another help line
114+
$modlin"
115+
testouterr_cmd_re bash {help help/1} OK $tserr
116+
117+
setenv_var TESTSUITE_HELP get_help_lines2
118+
set tserr "
119+
"
120+
testouterr_cmd_re bash {load help/1} $ans $tserr
121+
122+
123+
#
124+
# Cleanup
125+
#
126+
127+
reset_test_env

0 commit comments

Comments
 (0)