Debian Codegraph @

testsuite/modulefiles/spreadrc/dir3/1.0

raw
1 #%Module1.0
2
3 ##############################################################################
4 # Modules Revision 3.0
5 # Providing a flexible user environment
6 #
7 # File: spreadrc/%M%
8 # Revision: %I%
9 # First Edition: 2017/06/20
10 # Last Mod.: %U%, %G%
11 #
12 # Authors: Xavier Delaruelle, [email protected]
13 #
14 # Description: Testuite modulefile
15 # Command:
16 # Sub-Command:
17 #
18 # Invocation: load @M@, unload @M@, switch @M@ @M@,
19 # help @M@, display @M@, test @M@, whatis @M@
20 # Result: %R{
21 # }R%
22 # Comment: %C{
23 # Test how variable and procedure definitions spread from
24 # one modulerc or modulefile interpretation to another one.
25 # }C%
26 #
27 ##############################################################################
28
29
30 # test if specific or overridden pre-existing variables have spread here
31 # coming from modulerc or sibbling modulefiles
32 if {[info exists spreadrc]} {
33 puts stderr "variable spreadrc exists"
34 }
35 if {[info exists spreadmod]} {
36 puts stderr "variable spreadmod exists"
37 }
38 if {$tcl_version eq "test"} {
39 puts stderr "variable tcl_version equals test"
40 }
41 if {[array exists spreadrc_array]} {
42 puts stderr "array variable spreadrc_array exists"
43 }
44 if {[array exists spreadmod_array]} {
45 puts stderr "array variable spreadmod_array exists"
46 }
47 if {$tcl_platform(osVersion) eq "test"} {
48 puts stderr "variable tcl_platform(osVersion) equals test"
49 }
50 if {[llength $auto_path] <= 1} {
51 puts stderr "variable auto_path has lost elements"
52 }
53 if {[lsearch -exact $auto_path $env(TESTSUITEDIR)] > -1} {
54 puts stderr "variable auto_path contains $env(TESTSUITEDIR)"
55 }
56
57 # test if specific or overridden interpreter alias command have spread here
58 # coming from modulerc or sibbling modulefiles
59 set existing_proc [lindex [info procs] 0]
60 # test if first proc defined has been altered
61 if {[info procs $existing_proc] ne $existing_proc} {
62 puts stderr "procedure $existing_proc does not exist"
63 # env variable spread across interpretation and even between interpreters
64 } else {
65 # overridden proc does not spread as interp is renewed when a command is overridden
66 if {[info exists env(spreadmodcmd)] && [$existing_proc] eq "spreadmodcmd"} {
67 puts stderr "procedure $existing_proc has been altered"
68 }
69 if {[info exists env(spreadrc)] && [$existing_proc] eq "spreadrc"} {
70 puts stderr "procedure $existing_proc has been altered"
71 }
72 }
73 if {[info procs spreadrc_proc] eq "spreadrc_proc"} {
74 puts stderr "procedure spreadrc_proc exists"
75 }
76 if {[info procs spreadmod_proc] eq "spreadmod_proc"} {
77 puts stderr "procedure spreadmod_proc exists"
78 }
79 if {[info procs ModulesHelp] eq "ModulesHelp"} {
80 puts stderr "procedure ModulesHelp exists"
81 }
82 if {[info procs ModulesTest] eq "ModulesTest"} {
83 puts stderr "procedure ModulesTest exists"
84 }
85 if {[info procs ModulesDisplay] eq "ModulesDisplay"} {
86 puts stderr "procedure ModulesDisplay exists"
87 }
88 if {[info procs module-version] eq "module-version"} {
89 puts stderr "procedure module-version exists"
90 }
91 if {[info commands set] ne "set"} {
92 puts stderr "command set does not exist"
93 }
94
95
96 # define specific variables or override value in pre-existing variables
97 set spreadmod "yes"
98 set tcl_version "test"
99 array set spreadmod_array [list "yes" 1]
100 set tcl_platform(osVersion) "test"
101 lappend auto_path $env(TESTSUITEDIR)
102 set env(spreadmod) "yes"
103 set env(spreadmodcmd) "yes"
104
105 # define specific procs or override interpreter alias command
106 # override first proc defined
107 proc $existing_proc {args} {
108 return "spreadmodcmd"
109 }
110 proc spreadmod_proc {text} {
111 puts stderr "spreadmod_proc: $text"
112 }
113 proc ModulesHelp {} {
114 puts stderr "spreadmod"
115 }
116 proc ModulesTest {} {
117 puts stderr "spreadmod"
118 return 1
119 }
120 proc ModulesDisplay {} {
121 puts stderr "spreadmod"
122 }
123 proc module-version {args} {
124 puts stderr "spreadmod"
125 }
126 # define proc to override interpreter initial command
127 proc set {args} {
128 if {[lsearch -exact [list ::env(LOADEDMODULES) ::env(_LMFILES_) ::env(__MODULES_LMPREREQ) ::env(__MODULES_LMTAG) ::env(testspreadrccmd) ::env(testspreadrc) ::env(testspreadrccmdsub) ::env(testspreadrcsub) vrerrlist] [lindex $args 0]] == -1} {
129 puts stderr "spreadmod"
130 }
131 }