aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2014-10-10 18:45:34 +1000
committerSteve Bennett <steveb@workware.net.au>2014-10-10 19:07:19 +1000
commit97e38369e9957929ab86d1536018c97f921ec9ad (patch)
tree0093175237b6d8bd832590e55b7d19d4dae14df0 /tests
parent20e9c4c1decdadcec69e43bd7c14f51996baf94c (diff)
downloadjimtcl-97e38369e9957929ab86d1536018c97f921ec9ad.zip
jimtcl-97e38369e9957929ab86d1536018c97f921ec9ad.tar.gz
jimtcl-97e38369e9957929ab86d1536018c97f921ec9ad.tar.bz2
namespace: restore namespace import support
Commit 8e28d066 "fixed" infinite namespace import recursion by simply disabling support for import. This commit restores support by detecting self-import. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/namespace.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/namespace.test b/tests/namespace.test
index 98acf3e..090fcf0 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -470,6 +470,21 @@ test namespace-11.1 {command caching} {
lappend result [ns1::cmd2]
} {ns1 global}
+test namespace-12.1 {namespace import} {
+ namespace eval test_ns_scope1 {
+ proc a {} { return a }
+ namespace export a
+ }
+ namespace eval test_ns_scope2 {
+ namespace import ::test_ns_scope1::a
+ a
+ }
+} {a}
+
+test namespace-12.2 {namespace import recursive} -body {
+ namespace import *
+} -returnCodes error -match glob -result {import pattern "*" tries to import from namespace "*" into itself}
+
foreach cmd [info commands test_ns_*] {
rename $cmd ""
}