summaryrefslogtreecommitdiffstats
path: root/tests/for.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/for.test')
-rw-r--r--tests/for.test62
1 files changed, 31 insertions, 31 deletions
diff --git a/tests/for.test b/tests/for.test
index 239e4d6..a13ee54 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -62,15 +62,15 @@ test for-1.8 {TclCompileForCmd: error compiling command body} -body {
catch {unset a}
test for-1.9 {TclCompileForCmd: simple command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr $i+1]} {
- if $i==4 break
+ for {set i 1} {$i<6} {incr i} {
+ if {$i==4} break
set a [concat $a $i]
}
set a
} {1 2 3}
test for-1.10 {TclCompileForCmd: command body in quotes} {
set a {}
- for {set i 1} {$i<6} {set i [expr $i+1]} "append a x"
+ for {set i 1} {$i<6} {incr i} "append a x"
set a
} {xxxxx}
test for-1.11 {TclCompileForCmd: computed command body} {
@@ -81,7 +81,7 @@ test for-1.11 {TclCompileForCmd: computed command body} {
set bb {break}
set x2 {; append a x2}
set a {}
- for {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2
+ for {set i 1} {$i<6} {incr i} $x1$bb$x2
set a
} {x1}
test for-1.12 {TclCompileForCmd: error in "next" command} -body {
@@ -92,9 +92,9 @@ test for-1.12 {TclCompileForCmd: error in "next" command} -body {
"set"*}
test for-1.13 {TclCompileForCmd: long command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr $i+1]} {
- if $i==4 break
- if $i>5 continue
+ for {set i 1} {$i<6} {incr i} {
+ if {$i==4} break
+ if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -129,7 +129,7 @@ test for-1.14 {TclCompileForCmd: for command result} {
set a
} {}
test for-1.15 {TclCompileForCmd: for command result} {
- set a [for {set i 0} {$i < 5} {incr i} {if $i==3 break}]
+ set a [for {set i 0} {$i < 5} {incr i} {if {$i==3} break}]
set a
} {}
@@ -144,7 +144,7 @@ test for-2.2 {TclCompileContinueCmd: continue result} {
} 4
test for-2.3 {continue tests} {
set a {}
- for {set i 1} {$i <= 4} {set i [expr $i+1]} {
+ for {set i 1} {$i <= 4} {incr i} {
if {$i == 2} continue
set a [concat $a $i]
}
@@ -152,7 +152,7 @@ test for-2.3 {continue tests} {
} {1 3 4}
test for-2.4 {continue tests} {
set a {}
- for {set i 1} {$i <= 4} {set i [expr $i+1]} {
+ for {set i 1} {$i <= 4} {incr i} {
if {$i != 2} continue
set a [concat $a $i]
}
@@ -170,10 +170,10 @@ test for-2.5 {continue tests, nested loops} {
} {1.1 1.2 2.1 3.1 4.1}
test for-2.6 {continue tests, long command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr $i+1]} {
- if $i==2 continue
- if $i==4 break
- if $i>5 continue
+ for {set i 1} {$i<6} {incr i} {
+ if {$i==2} continue
+ if {$i==4} break
+ if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -246,10 +246,10 @@ test for-3.4 {break tests, nested loops} {
} {1.1 1.2 2.1 3.1 4.1}
test for-3.5 {break tests, long command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr $i+1]} {
- if $i==2 continue
- if $i==5 break
- if $i>5 continue
+ for {set i 1} {$i<6} {incr i} {
+ if {$i==2} continue
+ if {$i==5} break
+ if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -265,7 +265,7 @@ test for-3.5 {break tests, long command body} {
catch {incr i 5} msg
catch {incr i -5} msg
}
- if $i==4 break
+ if {$i==4} break
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg
@@ -386,7 +386,7 @@ proc formatMail {} {
continue
}
}
- if $inheaders {
+ if {$inheaders} {
set limit 55
} else {
set limit 55
@@ -430,12 +430,12 @@ proc formatMail {} {
continue
}
}
- set climit [expr $limit-1]
+ set climit [expr {$limit-1}]
set cutoff 50
set continuation 0
while {[string length $line] > $limit} {
- for {set c [expr $limit-1]} {$c >= $cutoff} {incr c -1} {
+ for {set c [expr {$limit-1}]} {$c >= $cutoff} {incr c -1} {
set char [string index $line $c]
if {$char == " " || $char == "\t"} {
break
@@ -446,7 +446,7 @@ proc formatMail {} {
}
if {$c < $cutoff} {
if {! $inheaders} {
- set c [expr $limit-1]
+ set c [expr {$limit-1}]
} else {
set c [string length $line]
}
@@ -585,7 +585,7 @@ Tcl/Tk Shop. Check it out!
test for-4.1 {break must reset the interp result} {
catch {
set z GLOBTESTDIR/dir2/file2.c
- if [string match GLOBTESTDIR/dir2/* $z] {
+ if {[string match GLOBTESTDIR/dir2/* $z]} {
break
}
} j
@@ -696,8 +696,8 @@ test for-6.9 {Tcl_ForObjCmd: error executing command body} -body {
test for-6.10 {Tcl_ForObjCmd: simple command body} {
set z for
set a {}
- $z {set i 1} {$i<6} {set i [expr $i+1]} {
- if $i==4 break
+ $z {set i 1} {$i<6} {incr i} {
+ if {$i==4} break
set a [concat $a $i]
}
set a
@@ -705,7 +705,7 @@ test for-6.10 {Tcl_ForObjCmd: simple command body} {
test for-6.11 {Tcl_ForObjCmd: command body in quotes} {
set z for
set a {}
- $z {set i 1} {$i<6} {set i [expr $i+1]} "append a x"
+ $z {set i 1} {$i<6} {incr i} "append a x"
set a
} {xxxxx}
test for-6.12 {Tcl_ForObjCmd: computed command body} {
@@ -717,7 +717,7 @@ test for-6.12 {Tcl_ForObjCmd: computed command body} {
set bb {break}
set x2 {; append a x2}
set a {}
- $z {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2
+ $z {set i 1} {$i<6} {incr i} $x1$bb$x2
set a
} {x1}
test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
@@ -733,9 +733,9 @@ test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
test for-6.14 {Tcl_ForObjCmd: long command body} {
set z for
set a {}
- $z {set i 1} {$i<6} {set i [expr $i+1]} {
- if $i==4 break
- if $i>5 continue
+ $z {set i 1} {$i<6} {incr i} {
+ if {$i==4} break
+ if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
catch {set a $a} msg
catch {incr i 5} msg