summaryrefslogtreecommitdiffstats
path: root/testing/058_bracket_recursion.tcl
diff options
context:
space:
mode:
authorwtschueller <wtschueller@users.noreply.github.com>2014-06-11 20:02:02 (GMT)
committerwtschueller <wtschueller@users.noreply.github.com>2014-06-11 20:02:02 (GMT)
commit9d315a987d7d0ea2f38809aa74e36c92281910df (patch)
tree4a9e4d87a5bf9fe26772e9000bc24391e4c8762f /testing/058_bracket_recursion.tcl
parent6245ef410358f332330195f9f2bfa458cfb6a2b8 (diff)
downloadDoxygen-9d315a987d7d0ea2f38809aa74e36c92281910df.zip
Doxygen-9d315a987d7d0ea2f38809aa74e36c92281910df.tar.gz
Doxygen-9d315a987d7d0ea2f38809aa74e36c92281910df.tar.bz2
Tcl: recurse for []
Diffstat (limited to 'testing/058_bracket_recursion.tcl')
-rw-r--r--testing/058_bracket_recursion.tcl141
1 files changed, 141 insertions, 0 deletions
diff --git a/testing/058_bracket_recursion.tcl b/testing/058_bracket_recursion.tcl
new file mode 100644
index 0000000..0a07087
--- /dev/null
+++ b/testing/058_bracket_recursion.tcl
@@ -0,0 +1,141 @@
+#// objective: tests processing of commands inside brackets [], only references/referencedby relations are relevant
+#// check: 058__bracket__recursion_8tcl.xml
+#// config: REFERENCED_BY_RELATION = yes
+#// config: REFERENCES_RELATION = yes
+#// config: EXTRACT_ALL = yes
+#// config: INLINE_SOURCES = yes
+
+##
+# \brief should be reference by every proc below
+proc Invoked args {
+ puts "Procedure \"Invoked\" is invoked indeed. Ok."
+ return $args
+}
+##
+# \brief must not be reference by every proc below
+proc NotInvoked args {
+ puts "Procedure \"NotInvoked\" is invoked. Not Ok!"
+ return $args
+}
+#
+# check if call references work at all
+proc a args {
+ Invoked NotInvoked
+ return
+}
+#
+# check brackets with various quoting, bracing
+proc b args {
+ set r [Invoked]
+ set r [list \[NotInvoked \]]
+ return
+}
+proc c args {
+ set r \{[Invoked]\}
+ set r {[NotInvoked]}
+ return
+}
+proc d args {
+ set r "[Invoked]"
+ set r "\[NotInvoked \]"
+ return
+}
+proc e args {
+ set r [list \[NotInvoked [Invoked]\]]
+ return
+}
+proc f args {
+ set r [list [Invoked \[NotInvoked \]]]
+ return
+}
+proc g args {
+ set r "{[Invoked]}"
+ set r "{\[NotInvoked \]}"
+ return
+}
+proc h args {
+ [Invoked set] r {[NotInvoked]}
+ return
+}
+# check brackets in tcl commands containing script arguments
+#
+# example generated according to
+# https://groups.google.com/d/msg/comp.lang.tcl/G5-mc3GiIyY/e-AVD9t7xMkJ
+proc i args {
+ foreach item [Invoked] {
+ return
+ }
+}
+proc j args {
+ foreach [Invoked item] [list one two three] {
+ }
+ return
+}
+proc k args {
+ while {[Invoked 0]} {
+ }
+}
+proc l args {
+ for {} {[Invoked 0]} {} {
+ }
+}
+proc m args {
+ if {[Invoked 1]} {
+ }
+}
+proc n args {
+ if [Invoked 1] {
+ }
+}
+proc o args {
+ if {0} {
+ } elseif {[Invoked 0]} {
+ }
+}
+# these are really nasty examples
+# they shows, that the condition argument may not be parsed as a script
+set NotInvoked \$NotInvoked
+proc $NotInvoked args {
+ puts "Procedure \"\$NotInvoked\" is invoked. Not Ok!"
+ return $args
+}
+proc p args {
+ set NotInvoked \$NotInvoked
+ if {$NotInvoked eq [Invoked 1]} {
+ }
+ return
+}
+proc q args {
+ set NotInvoked \$NotInvoked
+ if {0} {
+ } elseif {$NotInvoked eq [Invoked 1]} {
+ }
+ return
+}
+proc r args {
+ set NotInvoked \$NotInvoked
+ while {$NotInvoked eq [Invoked 1]} {
+ }
+ return
+}
+proc s args {
+ set NotInvoked \$NotInvoked
+ for {} {$NotInvoked eq [Invoked 1]} {} {
+ }
+ return
+}
+# dangling open brackets should not confuse the scanner
+proc t args {
+ set foo ]]]][Invoked]
+ return
+}
+
+#
+# call all single letter procs
+# let tcl check what is called and what is not called
+foreach p [info procs ?] {
+ puts "Check procedure \"$p\""
+ $p
+}
+exit
+