summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-04-28 13:11:28 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-04-28 13:11:28 (GMT)
commit74c3e73d8d217092ccc418bd990bf43f9d8890ce (patch)
tree81765be95085309d4c8abe150311d739005cb45c /tests
parent25b3a8473ed731844f2c5f093d1156a80c82e848 (diff)
downloadtcl-74c3e73d8d217092ccc418bd990bf43f9d8890ce.zip
tcl-74c3e73d8d217092ccc418bd990bf43f9d8890ce.tar.gz
tcl-74c3e73d8d217092ccc418bd990bf43f9d8890ce.tar.bz2
* doc/global.n:
* doc/upvar.n: * generic/tclVar.c (ObjMakeUpvar): * tests/upvar.test (upvar-8.11): * tests/var.test (var-3.11): Avoid creation of unusable variables: [Bug 600812] [TIP 184].
Diffstat (limited to 'tests')
-rw-r--r--tests/upvar.test7
-rw-r--r--tests/var.test7
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/upvar.test b/tests/upvar.test
index dcc2e23..ed9ce1d 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: upvar.test,v 1.8 2003/11/14 20:44:47 dgp Exp $
+# RCS: @(#) $Id: upvar.test,v 1.9 2004/04/28 13:11:35 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -336,6 +336,11 @@ test upvar-8.10 {upvar will create element alias for new array element} {
array set upvarArray {}
catch {upvar 0 upvarArray(elem) upvarArrayElemAlias}
} {0}
+test upvar-8.11 {upvar will not create a variable that looks like an array} -body {
+ catch {unset upvarArray}
+ array set upvarArray {}
+ upvar 0 upvarArray(elem) upvarArrayElemAlias(elem)
+} -returnCodes 1 -match glob -result *
if {[info commands testupvar] != {}} {
test upvar-9.1 {Tcl_UpVar2 procedure} {
diff --git a/tests/var.test b/tests/var.test
index 8969384..c675d63 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -14,7 +14,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: var.test,v 1.22 2003/05/12 17:20:41 msofer Exp $
+# RCS: @(#) $Id: var.test,v 1.23 2004/04/28 13:11:35 msofer Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -272,6 +272,11 @@ test var-3.10 {MakeUpvar, } {
set msg
}
} {1 1}
+test var-3.11 {MakeUpvar, my var looks like array elem} -body {
+ catch {unset aaaaa}
+ set aaaaa 789789
+ upvar #0 aaaaa foo(bar)
+} -returnCodes 1 -result {bad variable name "foo(bar)": upvar won't create a scalar variable that looks like an array element}
if {[info commands testgetvarfullname] != {}} {
test var-4.1 {Tcl_GetVariableName, global variable} {