summaryrefslogtreecommitdiffstats
path: root/tests/upvar.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/upvar.test')
-rw-r--r--tests/upvar.test44
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/upvar.test b/tests/upvar.test
index e2c9ffd..5ea870d 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -339,7 +339,7 @@ test upvar-8.9 {upvar won't create namespace variable that refers to procedure v
unset ::test_ns_1::a
}
MakeLink 1
-} -result {bad variable name "a": upvar won't create namespace variable that refers to procedure variable}
+} -result {bad variable name "a": can't create namespace variable that refers to procedure variable}
test upvar-8.10 {upvar will create element alias for new array element} -setup {
catch {unset upvarArray}
} -body {
@@ -414,6 +414,17 @@ test upvar-9.7 {Tcl_UpVar procedure} testupvar {
} {1234}
catch {unset a}
+test upvar-10.1 {CompileWord OBOE} -setup {
+ proc linenumber {} {dict get [info frame -1] line}
+} -body {
+ apply {n {
+ upvar 1 {*}{
+ } [return [incr n -[linenumber]]] x
+ }} [linenumber]
+} -cleanup {
+ rename linenumber {}
+} -result 1
+
#
# Tests for 'namespace upvar'. As the implementation is essentially the same as
# for 'upvar', we only test that the variables are linked correctly, i.e., we
@@ -536,6 +547,37 @@ test upvar-NS-2.2 {TIP 323} -setup {
} -cleanup {
namespace delete test_ns_1
} -result {}
+
+test upvar-NS-3.1 {CompileWord OBOE} -setup {
+ proc linenumber {} {dict get [info frame -1] line}
+} -body {
+ apply {n {
+ namespace upvar {*}{
+ } [return [incr n -[linenumber]]] x y
+ }} [linenumber]
+} -cleanup {
+ rename linenumber {}
+} -result 1
+test upvar-NS-3.2 {CompileWord OBOE} -setup {
+ proc linenumber {} {dict get [info frame -1] line}
+} -body {
+ apply {n {
+ namespace upvar :: {*}{
+ } [return [incr n -[linenumber]]] x
+ }} [linenumber]
+} -cleanup {
+ rename linenumber {}
+} -result 1
+test upvar-NS-3.3 {CompileWord OBOE} -setup {
+ proc linenumber {} {dict get [info frame -1] line}
+} -body {
+ apply {n {
+ variable x {*}{
+ } [return [incr n -[linenumber]]]
+ }} [linenumber]
+} -cleanup {
+ rename linenumber {}
+} -result 1
# cleanup
::tcltest::cleanupTests