#
if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+ package require tcltest 2.2
namespace import -force ::tcltest::*
}
set result
}
} {0 2 1 {can't set "foo": upvar refers to element in deleted array}}
+test var-1.19 {TclLookupVar, right error message when parsing variable name} {
+ list [catch {[format set] thisvar(doesntexist)} msg] $msg
+} {1 {can't read "thisvar(doesntexist)": no such variable}}
test var-2.1 {Tcl_LappendObjCmd, create var if new} {
catch {unset x}
catch {unset aaaaa}
set aaaaa 789789
list [catch {upvar #0 aaaaa test_ns_fred::lnk} msg] $msg
-} {1 {bad variable name "test_ns_fred::lnk": unknown namespace}}
+} {1 {can't create "test_ns_fred::lnk": parent namespace doesn't exist}}
if {[info commands testgetvarfullname] != {}} {
test var-4.1 {Tcl_GetVariableName, global variable} {
}
p
} {24}
+test var-6.4 {Tcl_GlobalObjCmd, variable name matching :*} {
+ # Test for Tcl Bug 480176
+ set :v broken
+ proc p {} {
+ global :v
+ set :v fixed
+ }
+ p
+ set :v
+} {fixed}
test var-7.1 {Tcl_VariableObjCmd, create and initialize one new ns variable} {
catch {namespace delete test_ns_var}
} res
set res
} "can't define \"arrayvar(1)\": name refers to an element in an array"
+test var-7.16 {Tcl_VariableObjCmd, no args} {
+ list [catch {variable} msg] $msg
+} {1 {wrong # args: should be "variable ?name value...? name ?value?"}}
+test var-7.17 {Tcl_VariableObjCmd, no args} {
+ namespace eval test_ns_var {
+ list [catch {variable} msg] $msg
+ }
+} {1 {wrong # args: should be "variable ?name value...? name ?value?"}}
test var-8.1 {TclDeleteVars, "unset" traces are called with fully-qualified var names} {
catch {namespace delete test_ns_var}
set x "If you see this, it worked"
} "If you see this, it worked"
+test var-14.1 {array names syntax} -body {
+ array names foo bar baz snafu
+} -returnCodes 1 -match glob -result *
+
catch {namespace delete ns}
catch {unset arr}
catch {unset v}
# cleanup
::tcltest::cleanupTests
return
-