summaryrefslogtreecommitdiffstats
path: root/tests/foreach.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/foreach.test')
-rw-r--r--tests/foreach.test19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/foreach.test b/tests/foreach.test
index abb88f4..8f452ed 100644
--- a/tests/foreach.test
+++ b/tests/foreach.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: foreach.test,v 1.10 2005/10/22 03:37:27 msofer Exp $
+# RCS: @(#) $Id: foreach.test,v 1.11 2007/03/01 10:07:12 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -163,7 +163,7 @@ test foreach-3.1 {compiled foreach backward jump works correctly} {
test foreach-4.1 {noncompiled foreach and shared variable or value list objects that are converted to another type} {
catch {unset x}
foreach {12.0} {a b c} {
- set x 12.0
+ set x 12.0
set x [expr $x + 1]
}
set x
@@ -210,7 +210,7 @@ test foreach-6.4 {break tests} {
catch {break foo} msg
set msg
} {wrong # args: should be "break"}
-# Check for bug #406709
+# Check for bug #406709
test foreach-6.5 {break tests} {
proc a {} {
set a 1
@@ -221,7 +221,6 @@ test foreach-6.5 {break tests} {
} {2}
# Test for incorrect "double evaluation" semantics
-
test foreach-7.1 {delayed substitution of body} {
proc foo {} {
set a 0
@@ -233,9 +232,7 @@ test foreach-7.1 {delayed substitution of body} {
foo
} {0}
-
# Test for [Bug 1189274]; crash on failure
-
test foreach-8.1 {empty list handling} {
proc crash {} {
rename crash {}
@@ -246,6 +243,16 @@ test foreach-8.1 {empty list handling} {
crash
} {}
+# [Bug 1671138]; infinite loop with empty var list in bytecompiled version
+test foreach-9.1 {compiled empty var list} {
+ proc foo {} {
+ foreach {} x {
+ error "reached body"
+ }
+ }
+ list [catch { foo } msg] $msg
+} {1 {foreach varlist is empty}}
+
# cleanup
catch {unset a}
catch {unset x}