diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-07-21 21:48:37 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-07-21 21:48:37 (GMT) |
commit | 6a77d40d48491f6d5c3dabe5a735ac475c14c493 (patch) | |
tree | c76bea3e15d9b35ebbc33ce09572debe570e3a00 /tests | |
parent | 62e6cfe58942a5ad17479f50213844599b49b9e6 (diff) | |
download | tcl-6a77d40d48491f6d5c3dabe5a735ac475c14c493.zip tcl-6a77d40d48491f6d5c3dabe5a735ac475c14c493.tar.gz tcl-6a77d40d48491f6d5c3dabe5a735ac475c14c493.tar.bz2 |
Compiler for [dict] and related changes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dict.test | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/dict.test b/tests/dict.test index f6c11d7..090142e 100644 --- a/tests/dict.test +++ b/tests/dict.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: dict.test,v 1.12 2004/10/19 22:20:05 dkf Exp $ +# RCS: @(#) $Id: dict.test,v 1.13 2005/07/21 21:49:08 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -306,6 +306,17 @@ test dict-11.15 {dict incr command: write failure} { catch {unset dictVar} set result } {1 {can't set "dictVar": variable is array}} +test dict-11.16 {dict incr command: compilation} { + proc dicttest {} { + set v {a 0 b 0 c 0} + dict incr v a + dict incr v b 1 + dict incr v c 2 + dict incr v d 3 + list [dict get $v a] [dict get $v b] [dict get $v c] [dict get $v d] + } + dicttest +} {1 1 2 3} test dict-12.1 {dict lappend command} { set dictv {a a} @@ -511,6 +522,17 @@ test dict-14.15 {dict for command: keys are unique and iterated over once only} catch {unset accum} set result } {a1 a2 b1 b2 bar foo : a, b, c, d, foo, bar,} +test dict-14.16 {dict for command in compilation context} { + proc dicttest {} { + set res {x x x x x x} + dict for {k v} {a 0 b 1 c 2 d 3 e 4 f 5} { + lset res $v $k + continue + } + return $res + } + dicttest +} {a b c d e f} # There's probably a lot more tests to add here. Really ought to use # a coverage tool for this job... @@ -968,6 +990,19 @@ test dict-21.12 {dict update command} { } getOrder $a b d f } {b c d e f g 3} +test dict-21.13 {dict update command: compilation} { + proc dicttest {d} { + while 1 { + dict update d a alpha b beta { + set beta $alpha + unset alpha + break + } + } + return $d + } + getOrder [dicttest {a 1 c 2}] b c +} {b 1 c 2 2} test dict-22.1 {dict with command} -body { dict with |