diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-02-15 09:51:12 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-02-15 09:51:12 (GMT) |
commit | 5ab653feb0f92621dfa72b70722477353ae22c75 (patch) | |
tree | 15ffd01c86b50f1a31f9efed63079cb78f8d839c /tests | |
parent | 9d25d39845a0c2c1c3282634394e39a542ae0d9e (diff) | |
download | tcl-5ab653feb0f92621dfa72b70722477353ae22c75.zip tcl-5ab653feb0f92621dfa72b70722477353ae22c75.tar.gz tcl-5ab653feb0f92621dfa72b70722477353ae22c75.tar.bz2 |
* generic/tclCompCmds.c (TclCompileDictForCmd): [Bug 3487626]: Fix
crash in compilation of [dict for] when its implementation command is
used directly rather than through the ensemble.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dict.test | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/dict.test b/tests/dict.test index 5821c32..b92893e 100644 --- a/tests/dict.test +++ b/tests/dict.test @@ -1194,6 +1194,57 @@ test dict-22.11 {dict with command: no recursive structures [Bug 1786481]} { string range [append foo OK] end-1 end } OK +proc linenumber {} { + dict get [info frame -1] line +} +test dict-23.1 {dict compilation crash: Bug 3487626} { + apply {n { + set e {} + set k {} + dict for {a b} {c {d {e {f g}}}} { + ::tcl::dict::for {h i} $b { + dict update i e j { + ::tcl::dict::update j f k { + return [expr {$n - [linenumber]}] + } + } + } + } + }} [linenumber] +} 5 +test dict-23.2 {dict compilation crash: Bug 3487626} knownBug { + # Something isn't quite right in line number and continuation line + # tracking; at time of writing, this test produces 7, not 5, which + # indicates that the extra newlines in the non-script argument are + # confusing things. + apply {n { + set e {} + set k {} + dict for {a { +b +}} {c {d {e {f g}}}} { + ::tcl::dict::for {h { +i +}} ${ +b +} { + dict update { +i +} e { +j +} { + ::tcl::dict::update { +j +} f k { + return [expr {$n - [linenumber]}] + } + } + } + } + }} [linenumber] +} 5 +rename linenumber {} + # cleanup ::tcltest::cleanupTests return |