summaryrefslogtreecommitdiff
path: root/tcl/tests/autoMkindex.tcl
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-11-09 01:28:43 +0000
committerJason Molenda <jmolenda@apple.com>1999-11-09 01:28:43 +0000
commiteceff73081bb2d5ebd624f6e2b775e93c4c7b298 (patch)
treeee2bc71d61f78dbfdf494640cfb678822e101cef /tcl/tests/autoMkindex.tcl
parent69a7b5f79888513741e65a54216d7756474b76c2 (diff)
downloadgdb-eceff73081bb2d5ebd624f6e2b775e93c4c7b298.tar.gz
import dejagnu-1999-11-08 snapshotdejagnu-1999-11-08
Diffstat (limited to 'tcl/tests/autoMkindex.tcl')
-rw-r--r--tcl/tests/autoMkindex.tcl52
1 files changed, 52 insertions, 0 deletions
diff --git a/tcl/tests/autoMkindex.tcl b/tcl/tests/autoMkindex.tcl
new file mode 100644
index 00000000000..7a72fbe824e
--- /dev/null
+++ b/tcl/tests/autoMkindex.tcl
@@ -0,0 +1,52 @@
+# Test file for:
+# auto_mkindex
+#
+# This file provides example cases for testing the Tcl autoloading
+# facility. Things are much more complicated with namespaces and classes.
+# The "auto_mkindex" facility can no longer be built on top of a simple
+# regular expression parser. It must recognize constructs like this:
+#
+# namespace eval foo {
+# proc test {x y} { ... }
+# namespace eval bar {
+# proc another {args} { ... }
+# }
+# }
+#
+# Note that procedures and itcl class definitions can be nested inside
+# of namespaces.
+#
+# Copyright (c) 1993-1998 Lucent Technologies, Inc.
+
+# This shouldn't cause any problems
+namespace import -force blt::*
+
+# Should be able to handle "proc" definitions, even if they are
+# preceded by white space.
+
+proc normal {x y} {return [expr $x+$y]}
+ proc indented {x y} {return [expr $x+$y]}
+
+#
+# Should be able to handle proc declarations within namespaces,
+# even if they have explicit namespace paths.
+#
+namespace eval buried {
+ proc inside {args} {return "inside: $args"}
+
+ namespace export pub_*
+ proc pub_one {args} {return "one: $args"}
+ proc pub_two {args} {return "two: $args"}
+}
+proc buried::within {args} {return "within: $args"}
+
+namespace eval buried {
+ namespace eval under {
+ proc neath {args} {return "neath: $args"}
+ }
+ namespace eval ::buried {
+ proc relative {args} {return "relative: $args"}
+ proc ::top {args} {return "top: $args"}
+ proc ::buried::explicit {args} {return "explicit: $args"}
+ }
+}