summaryrefslogtreecommitdiffstats
path: root/tests/for.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/for.test')
-rw-r--r--tests/for.test126
1 files changed, 126 insertions, 0 deletions
diff --git a/tests/for.test b/tests/for.test
index cd34781..6c710bb 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -1224,6 +1224,132 @@ test for-8.2 {Coverity CID 1251203: break vs continue in for-step clause} {
list $i $j $k
}}
} {1 1 3}
+test for-8.3 {break 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; break} {
+ incr j
+ }]
+ incr i
+ }
+ list $i $j $k
+ }}
+} {2 1 3}
+test for-8.4 {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; continue} {
+ incr j
+ }]
+ incr i
+ }
+ list $i $j $k
+ }}
+} {1 1 3}
+test for-8.5 {break 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 [break]} {
+ incr j
+ }]
+ incr i
+ }
+ list $i $j $k
+ }}
+} {2 1 3}
+test for-8.6 {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 [continue]} {
+ incr j
+ }]
+ incr i
+ }
+ list $i $j $k
+ }}
+} {1 1 3}
+test for-8.7 {break 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;eval break} {
+ incr j
+ }]
+ incr i
+ }
+ list $i $j $k
+ }}
+} {2 1 3}
+test for-8.8 {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;eval continue} {
+ incr j
+ }]
+ incr i
+ }
+ list $i $j $k
+ }}
+} {1 1 3}
+test for-8.9 {break in for-step clause} {
+ apply {{} {
+ for {set k 0} {$k < 3} {incr k} {
+ set j 0
+ for {set i 0} {$i < 5} {incr i;eval break} {
+ incr j
+ }
+ incr i
+ }
+ list $i $j $k
+ }}
+} {2 1 3}
+test for-8.10 {continue in for-step clause} knownBug {
+ apply {{} {
+ for {set k 0} {$k < 3} {incr k} {
+ set j 0
+ for {set i 0} {$i < 5} {incr i;eval continue} {
+ incr j
+ }
+ incr i
+ }
+ list $i $j $k
+ }}
+} {1 1 3}
+test for-8.11 {break in for-step clause} {
+ apply {{} {
+ for {set k 0} {$k < 3} {incr k} {
+ set j 0
+ for {set i 0} {$i < 5} {incr i;break} {
+ incr j
+ }
+ incr i
+ }
+ list $i $j $k
+ }}
+} {2 1 3}
+test for-8.12 {continue in for-step clause} {
+ apply {{} {
+ for {set k 0} {$k < 3} {incr k} {
+ set j 0
+ for {set i 0} {$i < 5} {incr i;continue} {
+ incr j
+ }
+ incr i
+ }
+ list $i $j $k
+ }}
+} {1 1 3}
# cleanup
::tcltest::cleanupTests