summaryrefslogtreecommitdiffstats
path: root/tests/var.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/var.test')
-rw-r--r--tests/var.test63
1 files changed, 22 insertions, 41 deletions
diff --git a/tests/var.test b/tests/var.test
index 45b7207..698cd20 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -13,6 +13,9 @@
#
# 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.34 2008/09/25 19:51:29 dgp Exp $
+#
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.2
@@ -31,7 +34,7 @@ catch {unset y}
catch {unset i}
catch {unset a}
catch {unset arr}
-
+
test var-1.1 {TclLookupVar, Array handling} {
catch {unset a}
set x "incr" ;# force no compilation and runtime call to Tcl_IncrCmd
@@ -349,6 +352,15 @@ test var-6.4 {Tcl_GlobalObjCmd, variable name matching :*} {
p
set :v
} {fixed}
+test var-6.5 {Tcl_GlobalObjCmd, no-op case (TIP 323)} {
+ global
+} {}
+test var-6.6 {Tcl_GlobalObjCmd, no-op case (TIP 323)} {
+ proc p {} {
+ global
+ }
+ p
+} {}
test var-7.1 {Tcl_VariableObjCmd, create and initialize one new ns variable} {
catch {namespace delete test_ns_var}
@@ -498,14 +510,14 @@ test var-7.15 {Tcl_VariableObjCmd, array element parameter} {
} 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} {
+test var-7.16 {Tcl_VariableObjCmd, no args (TIP 323)} {
+ variable
+} {}
+test var-7.17 {Tcl_VariableObjCmd, no args (TIP 323)} {
namespace eval test_ns_var {
- list [catch {variable} msg] $msg
+ variable
}
-} {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}
@@ -713,9 +725,9 @@ test var-15.1 {segfault in [unset], [Bug 735335]} {
test var-16.1 {CallVarTraces: save/restore interp error state} {
- trace add variable ::errorCode write " ;#"
+ trace add variable ::errorCode write { ;#}
catch {error foo bar baz}
- trace remove variable ::errorCode write " ;#"
+ trace remove variable ::errorCode write { ;#}
set ::errorInfo
} bar
@@ -724,40 +736,13 @@ test var-17.1 {TclArraySet [Bug 1669489]} -setup {
} -body {
namespace eval :: {
set elements {1 2 3 4}
- trace add variable a write "string length \$elements ;#"
+ trace add variable a write {string length $elements ;#}
array set a $elements
}
} -cleanup {
unset -nocomplain ::a ::elements
} -result {}
-test var-18.1 {array unset and unset traces: Bug 2939073} -setup {
- set already 0
- unset x
-} -body {
- array set x {e 1 i 1}
- trace add variable x unset {apply {args {
- global already x
- if {!$already} {
- set already 1
- unset x(i)
- }
- }}}
- # The next command would crash reliably with memory debugging prior to the
- # bug fix.
- array unset x *
- array size x
-} -cleanup {
- unset x already
-} -result 0
-
-
-test var-19.1 {crash when freeing locals hashtable: Bug 3037525} {
- proc foo {} { catch {upvar 0 dummy \$index} }
- foo ; # This crashes without the fix for the bug
- rename foo {}
-} {}
-
catch {namespace delete ns}
catch {unset arr}
catch {unset v}
@@ -776,7 +761,3 @@ catch {unset aaaaa}
# cleanup
::tcltest::cleanupTests
return
-
-# Local Variables:
-# mode: tcl
-# End: