diff options
-rw-r--r-- | tests/for-old.test | 10 | ||||
-rw-r--r-- | tests/for.test | 24 | ||||
-rw-r--r-- | tests/list.test | 2 |
3 files changed, 18 insertions, 18 deletions
diff --git a/tests/for-old.test b/tests/for-old.test index d68f05a..baf40fa 100644 --- a/tests/for-old.test +++ b/tests/for-old.test @@ -22,14 +22,14 @@ if {"::tcltest" ni [namespace children]} { catch {unset a i} test for-old-1.1 {for tests} { set a {} - for {set i 1} {$i<6} {set i [expr {$i+1}]} { + for {set i 1} {$i<6} {incr i} { set a [concat $a $i] } set a } {1 2 3 4 5} test for-old-1.2 {for tests} { set a {} - for {set i 1} {$i<6} {set i [expr {$i+1}]} { + for {set i 1} {$i<6} {incr i} { if {$i==4} continue set a [concat $a $i] } @@ -37,7 +37,7 @@ test for-old-1.2 {for tests} { } {1 2 3 5} test for-old-1.3 {for tests} { set a {} - for {set i 1} {$i<6} {set i [expr {$i+1}]} { + for {set i 1} {$i<6} {incr i} { if {$i==4} break set a [concat $a $i] } @@ -55,12 +55,12 @@ test for-old-1.7 {for tests} { } {wrong # args: should be "for start test next command"} test for-old-1.8 {for tests} { set a {xyz} - for {set i 1} {$i<6} {set i [expr {$i+1}]} {} + for {set i 1} {$i<6} {incr i} {} set a } xyz test for-old-1.9 {for tests} { 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 diff --git a/tests/for.test b/tests/for.test index 77638d4..a13ee54 100644 --- a/tests/for.test +++ b/tests/for.test @@ -62,7 +62,7 @@ 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}]} { + for {set i 1} {$i<6} {incr i} { if {$i==4} break set a [concat $a $i] } @@ -70,7 +70,7 @@ test for-1.9 {TclCompileForCmd: simple command body} { } {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,7 +92,7 @@ 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}]} { + for {set i 1} {$i<6} {incr i} { if {$i==4} break if {$i>5} continue if {$i>6 && $tcl_platform(machine)=="xxx"} { @@ -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,7 +170,7 @@ 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}]} { + for {set i 1} {$i<6} {incr i} { if {$i==2} continue if {$i==4} break if {$i>5} continue @@ -246,7 +246,7 @@ 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}]} { + for {set i 1} {$i<6} {incr i} { if {$i==2} continue if {$i==5} break if {$i>5} continue @@ -696,7 +696,7 @@ 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}]} { + $z {set i 1} {$i<6} {incr i} { if {$i==4} break set a [concat $a $i] } @@ -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,7 +733,7 @@ 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}]} { + $z {set i 1} {$i<6} {incr i} { if {$i==4} break if {$i>5} continue if {$i>6 && $tcl_platform(machine)=="xxx"} { diff --git a/tests/list.test b/tests/list.test index 8e85ed8..864fad0 100644 --- a/tests/list.test +++ b/tests/list.test @@ -108,7 +108,7 @@ proc slowsort list { set minIndex $i set min [lindex $list $i] } - set i [expr {$i - 1}] + incr i -1 } set result [concat $result [list $min]] if {$minIndex == 0} { |