summaryrefslogtreecommitdiff
path: root/tests/misc.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-01-24 12:58:35 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:45 +1000
commit541fe7c30691ace08847a35280d9cc8bc02e9a72 (patch)
tree530be84682be78cc1e34b5feaa64ee388f725768 /tests/misc.test
parent5dbbcf87423edb96cde7dfe59a2c8ef0a9d8ae2f (diff)
Allow incr on unset variable
From Tcl 8.5, implicitly set variable to 0
Diffstat (limited to 'tests/misc.test')
-rw-r--r--tests/misc.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/misc.test b/tests/misc.test
index 804e456..eda2879 100644
--- a/tests/misc.test
+++ b/tests/misc.test
@@ -216,4 +216,25 @@ test lindex-1.20 "unary plus" {
lindex {a b c} +2
} c
+test incr-1.1 "incr unset" {
+ unset -nocomplain a
+ incr a
+ set a
+} 1
+
+test incr-1.2 "incr, incr unset" {
+ incr a
+} 2
+
+test incr-1.3 "incr unset array element" {
+ unset -nocomplain a
+ incr a(2)
+ set a(2)
+} 1
+
+test incr-1.4 "incr array element - shimmering" {
+ set b "$a(2)-test"
+ incr a(2)
+} 2
+
testreport