diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-01-24 12:58:35 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-10-15 11:02:45 +1000 |
commit | 541fe7c30691ace08847a35280d9cc8bc02e9a72 (patch) | |
tree | 530be84682be78cc1e34b5feaa64ee388f725768 /tests | |
parent | 5dbbcf87423edb96cde7dfe59a2c8ef0a9d8ae2f (diff) | |
download | jimtcl-541fe7c30691ace08847a35280d9cc8bc02e9a72.zip jimtcl-541fe7c30691ace08847a35280d9cc8bc02e9a72.tar.gz jimtcl-541fe7c30691ace08847a35280d9cc8bc02e9a72.tar.bz2 |
Allow incr on unset variable
From Tcl 8.5, implicitly set variable to 0
Diffstat (limited to 'tests')
-rw-r--r-- | tests/errors.tcl | 2 | ||||
-rw-r--r-- | tests/misc.test | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/errors.tcl b/tests/errors.tcl index f6ecc32..a544faf 100644 --- a/tests/errors.tcl +++ b/tests/errors.tcl @@ -6,7 +6,7 @@ proc error_generator {type} { bogus command called } \ badvar { - incr bogus + set bogus } \ error { error bogus 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 |