summaryrefslogtreecommitdiffstats
path: root/tests/for.test
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-09-19 18:17:54 (GMT)
committerhobbs <hobbs>2001-09-19 18:17:54 (GMT)
commit93f8aa9a4503e99c92cc046261e09d99e638c188 (patch)
treebd67a555349bc2a086720174d0243daff86a7c77 /tests/for.test
parenteaecbc2b998c46334ae14212a09eadfce713b4ab (diff)
downloadtcl-93f8aa9a4503e99c92cc046261e09d99e638c188.zip
tcl-93f8aa9a4503e99c92cc046261e09d99e638c188.tar.gz
tcl-93f8aa9a4503e99c92cc046261e09d99e638c188.tar.bz2
* generic/tclCompCmds.c (TclCompileStringCmd): INST_STR_MATCH -
Updated to Int1 instruction type and added special case to use INST_STR_EQ instead when no glob chars are specified in a static string. * tests/{for.test,foreach.test,if.test,while.test}: * generic/tclCompCmds.c (TclCompileForCmd, TclCompileForeachCmd, TclCompileIfCmd, TclCompileWhileCmd): Corrected the overaggressive compiling of loop bodies enclosed in ""s. [Bug #219166] (msofer)
Diffstat (limited to 'tests/for.test')
-rw-r--r--tests/for.test32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/for.test b/tests/for.test
index fe36719..95ed356 100644
--- a/tests/for.test
+++ b/tests/for.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: for.test,v 1.6 2000/04/10 17:18:59 ericm Exp $
+# RCS: @(#) $Id: for.test,v 1.7 2001/09/19 18:17:54 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -587,8 +587,8 @@ test for-4.1 {break must reset the interp result} {
# Test for incorrect "double evaluation" semantics
-test for-5.1 {possible delayed substitution of increment command} {knownBug} {
- # Increment should be 5, and lappend should always append 5
+test for-5.1 {possible delayed substitution of increment command} {
+ # Increment should be 5, and lappend should always append $a
catch {unset a}
catch {unset i}
set a 5
@@ -597,13 +597,35 @@ test for-5.1 {possible delayed substitution of increment command} {knownBug} {
set i
} {1 6 11}
-test for-5.2 {possible delayed substitution of body command} {knownBug} {
- # Increment should be 5, and lappend should always append 5
+test for-5.2 {possible delayed substitution of increment command} {
+ # Increment should be 5, and lappend should always append $a
+ catch {rename p ""}
+ proc p {} {
+ set a 5
+ set i {}
+ for {set a 1} {$a < 12} "incr a $a" {lappend i $a}
+ set i
+ }
+ p
+} {1 6 11}
+test for-5.3 {possible delayed substitution of body command} {
+ # Increment should be $a, and lappend should always append 5
set a 5
set i {}
for {set a 1} {$a < 12} {incr a $a} "lappend i $a"
set i
} {5 5 5 5}
+test for-5.4 {possible delayed substitution of body command} {
+ # Increment should be $a, and lappend should always append 5
+ catch {rename p ""}
+ proc p {} {
+ set a 5
+ set i {}
+ for {set a 1} {$a < 12} {incr a $a} "lappend i $a"
+ set i
+ }
+ p
+} {5 5 5 5}
# In the following tests we need to bypass the bytecode compiler by
# substituting the command from a variable. This ensures that command