1 #// objective: tests processing of switch, only references/referencedby relations are relevant
2 #// check: 060__command__switch_8tcl.xml
3 #// config: REFERENCED_BY_RELATION = yes
4 #// config: REFERENCES_RELATION = yes
5 #// config: EXTRACT_ALL = yes
6 #// config: INLINE_SOURCES = no
9 # \brief should be reference by every proc below
11 puts "Procedure \"Invoked\" is invoked indeed. Ok."
15 # \brief must not be reference by every proc below
16 proc NotInvoked args {
17 puts "Procedure \"NotInvoked\" is invoked. Not Ok!"
21 # check if call references work at all
28 # switch ?options? string pattern body ?pattern body ...?
30 switch value NotInvoked {
38 switch value NotInvoked {
45 switch NotInvoked pattern {
52 switch [Invoked] pattern {
59 switch -exact value pattern {
67 switch -exact -- value pattern {
75 switch -exact -- -value pattern {
82 # switch ?options? string {pattern body ?pattern body ...?}
131 switch -exact value {
143 switch -exact -- value {
155 switch -exact -- -value {
167 switch -exact -- inquotes {
177 switch -exact -- "in quotes" {
187 switch -exact -- inbraces {
197 switch -exact -- {in braces} {
208 # catch {switch -exact -- [Invoked] pattern1 NotInvoked pattern2}
211 # The current version does not check the last argument beforehand.
212 # Therefore, all script elements are evaluated as scripts before
213 # the parser detects the dangling pattern. It throws a warning, at the very least.
214 # Anyway, for working code the documentation will be correct.
216 # catch {switch -exact -- [Invoked] {
231 # call all single letter procs
232 # let tcl check what is called and what is not called
233 foreach p [info procs ?] {
234 puts "Check procedure \"$p\""