From 541fe7c30691ace08847a35280d9cc8bc02e9a72 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 24 Jan 2010 12:58:35 +1000 Subject: Allow incr on unset variable From Tcl 8.5, implicitly set variable to 0 --- tests/misc.test | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/misc.test') 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 -- cgit v1.1