diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2015-08-01 19:37:04 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2015-08-01 19:37:04 (GMT) |
commit | 9bacb3fab61a4db75d9e98c04a3ea906265e8249 (patch) | |
tree | 214064572682de264f1ef15996e7bb6d7e7ca4e1 /tests | |
parent | 6d2f884f461d22c6f2fef2ef38f299532fc16bb4 (diff) | |
download | tcl-9bacb3fab61a4db75d9e98c04a3ea906265e8249.zip tcl-9bacb3fab61a4db75d9e98c04a3ea906265e8249.tar.gz tcl-9bacb3fab61a4db75d9e98c04a3ea906265e8249.tar.bz2 |
Fix Coverity CID 1251203: break vs continue in for-step clause
Diffstat (limited to 'tests')
-rw-r--r-- | tests/for.test | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/for.test b/tests/for.test index 8abd270..cd34781 100644 --- a/tests/for.test +++ b/tests/for.test @@ -1184,6 +1184,46 @@ test for-7.24 {Bug 3614226: ensure that continue from expanded command only clea expr {$end - $tmp} }} {return -level 0 -code continue} } 0 + +test for-8.0 {Coverity CID 1251203: break vs continue in for-step clause} { + apply {{} { + for {set k 0} {$k < 3} {incr k} { + set j 0 + list a [\ + for {set i 0} {$i < 5} {incr i; list a [eval {}]} { + incr j + }] + incr i + } + list $i $j $k + }} +} {6 5 3} +test for-8.1 {Coverity CID 1251203: break vs continue in for-step clause} { + apply {{} { + for {set k 0} {$k < 3} {incr k} { + set j 0 + list a [\ + for {set i 0} {$i < 5} {incr i;list a [eval break]} { + incr j + }] + incr i + } + list $i $j $k + }} +} {2 1 3} +test for-8.2 {Coverity CID 1251203: break vs continue in for-step clause} { + apply {{} { + for {set k 0} {$k < 3} {incr k} { + set j 0 + list a [\ + for {set i 0} {$i < 5} {incr i;list a [eval continue]} { + incr j + }] + incr i + } + list $i $j $k + }} +} {1 1 3} # cleanup ::tcltest::cleanupTests |