Debian Codegraph @

testsuite/modulefiles/spreadrc/dir1/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/18
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 if {[info exists env(spreadmod)] && [$existing_proc] ne "spreadmod"} {
66 puts stderr "procedure $existing_proc has not been altered"
67 }
68 if {[info exists env(spreadrc)] && [$existing_proc] eq "spreadrc"} {
69 puts stderr "procedure $existing_proc has been altered"
70 }
71 }
72 if {[info procs spreadrc_proc] eq "spreadrc_proc"} {
73 puts stderr "procedure spreadrc_proc exists"
74 }
75 if {[info procs spreadmod_proc] eq "spreadmod_proc"} {
76 puts stderr "procedure spreadmod_proc exists"
77 }
78 if {[info procs ModulesHelp] eq "ModulesHelp"} {
79 puts stderr "procedure ModulesHelp exists"
80 }
81 if {[info procs ModulesTest] eq "ModulesTest"} {
82 puts stderr "procedure ModulesTest exists"
83 }
84 if {[info procs ModulesDisplay] eq "ModulesDisplay"} {
85 puts stderr "procedure ModulesDisplay exists"
86 }
87 if {[info procs module-version] eq "module-version"} {
88 puts stderr "procedure module-version exists"
89 }
90
91
92 # define specific variables or override value in pre-existing variables
93 set spreadmod "yes"
94 set tcl_version "test"
95 array set spreadmod_array [list "yes" 1]
96 set tcl_platform(osVersion) "test"
97 lappend auto_path $env(TESTSUITEDIR)
98 set env(spreadmod) "yes"
99
100 # define specific procs or override interpreter alias command
101 # override first proc defined
102 proc $existing_proc {args} {
103 return "spreadmod"
104 }
105 proc spreadmod_proc {text} {
106 puts stderr "spreadmod_proc: $text"
107 }
108 proc ModulesHelp {} {
109 puts stderr "spreadmod"
110 }
111 proc ModulesTest {} {
112 puts stderr "spreadmod"
113 return 1
114 }
115 proc ModulesDisplay {} {
116 puts stderr "spreadmod"
117 }
118 proc module-version {args} {
119 puts stderr "spreadmod"
120 }
121