diff options
Diffstat (limited to 'tests/while.test')
-rw-r--r-- | tests/while.test | 85 |
1 files changed, 40 insertions, 45 deletions
diff --git a/tests/while.test b/tests/while.test index 642ec93..de12d53 100644 --- a/tests/while.test +++ b/tests/while.test @@ -17,8 +17,7 @@ if {"::tcltest" ni [namespace children]} { # Basic "while" operation. -catch {unset i} -catch {unset a} +unset -nocomplain i a test while-1.1 {TclCompileWhileCmd: missing test expression} -body { while @@ -94,16 +93,14 @@ test while-1.10 {TclCompileWhileCmd: command body in quotes} -body { unset a i } -result {xxxxx} test while-1.11 {TclCompileWhileCmd: computed command body} -setup { - catch {unset x1} - catch {unset bb} - catch {unset x2} + unset -nocomplain x1 bb x2 } -body { set x1 {append a x1; } set bb {break} set x2 {; append a x2; incr i} - set a {} + set a "" set i 1 - while {$i<6} $x1$bb$x2 + while {$i < 6} $x1$bb$x2 return $a } -cleanup { unset x1 bb x2 a i @@ -114,27 +111,27 @@ test while-1.12 {TclCompileWhileCmd: long command body} -body { while {$i<6} { if $i==4 break if $i>5 continue - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg @@ -210,27 +207,27 @@ test while-2.4 {continue tests, long command body} -body { if $i==2 {incr i; continue} if $i==4 break if $i>5 continue - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg @@ -274,34 +271,34 @@ test while-3.2 {break tests, nested loops} -body { unset a i msg } -result {1.1 1.2 2.1 3.1 4.1} test while-3.3 {break tests, long command body} -body { - set a {} + set a "" set i 1 - while {$i<6} { - if $i==2 {incr i; continue} - if $i==5 break - if $i>5 continue - if {$i>6 && $tcl_platform(machine)=="xxx"} { + while {$i < 6} { + if {$i == 2} {incr i; continue} + if {$i == 5} break + if {$i > 5} continue + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } if $i==4 break - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg @@ -419,9 +416,7 @@ test while-4.11 {while (not compiled): command body in quotes} -body { unset a i z } -result {xxxxx} test while-4.12 {while (not compiled): computed command body} -setup { - catch {unset x1} - catch {unset bb} - catch {unset x2} + unset -nocomplain x1 bb x2 } -body { set z while set x1 {append a x1; } @@ -441,27 +436,27 @@ test while-4.13 {while (not compiled): long command body} -body { $z {$i<6} { if $i==4 break if $i>5 continue - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg @@ -541,28 +536,28 @@ test while-5.4 {break tests, long command body with computed command names} -bod if $i==2 {incr i; continue} if $i==5 $z if $i>5 continue - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } if $i==4 $z - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg @@ -640,27 +635,27 @@ test while-6.5 {continue tests, long command body with computed command names} - if $i==2 {incr i; continue} if $i==4 break if $i>5 $z - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg } - if {$i>6 && $tcl_platform(machine)=="xxx"} { + if {($i > 6) && ($tcl_platform(machine) eq "xxx")} { catch {set a $a} msg catch {incr i 5} msg catch {incr i -5} msg |