diff options
Diffstat (limited to 'tests/if.test')
-rw-r--r-- | tests/if.test | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/tests/if.test b/tests/if.test index bbf10bc..5f625b9 100644 --- a/tests/if.test +++ b/tests/if.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: if.test,v 1.10 2006/08/22 04:03:24 dgp Exp $ +# RCS: @(#) $Id: if.test,v 1.11 2006/08/22 18:10:44 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -28,12 +28,7 @@ test if-1.2 {TclCompileIfCmd: error in if/elseif test} { } {1 {error in condition}} test if-1.3 {TclCompileIfCmd: error in if/elseif test} -body { list [catch {if {1+}} msg] $msg $errorInfo -} -result {1 {missing operand at _@_ -in expression "1+_@_"} {missing operand at _@_ -in expression "1+_@_" - (parsing expression "1+") - invoked from within -"if {1+}"}} +} -match glob -result {1 * {*"if {1+}"}} test if-1.4 {TclCompileIfCmd: if/elseif test in braces} { set a {} if {1<2} {set a 1} @@ -179,12 +174,7 @@ test if-2.3 {TclCompileIfCmd: missing expression after "elseif"} { test if-2.4 {TclCompileIfCmd: error in expression after "elseif"} -body { set a {} list [catch {if 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo -} -result {1 {missing operand at _@_ -in expression "1>_@_"} {missing operand at _@_ -in expression "1>_@_" - (parsing expression "1>") - invoked from within -"if 3>4 {set a 1} elseif {1>}"}} +} -match glob -result {1 * {*"if 3>4 {set a 1} elseif {1>}"}} test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long "elseif" body} { catch {unset i} set a {} @@ -507,15 +497,10 @@ test if-5.2 {if cmd with computed command names: error in if/elseif test} { set z if list [catch {$z {[error "error in condition"]} foo} msg] $msg } {1 {error in condition}} -test if-5.3 {if cmd with computed command names: error in if/elseif test} { +test if-5.3 {if cmd with computed command names: error in if/elseif test} -body { set z if list [catch {$z {1+}} msg] $msg $errorInfo -} {1 {missing operand at _@_ -in expression "1+_@_"} {missing operand at _@_ -in expression "1+_@_" - (parsing expression "1+") - invoked from within -"$z {1+}"}} +} -match glob -result {1 * {*"$z {1+}"}} test if-5.4 {if cmd with computed command names: if/elseif test in braces} { set z if set a {} @@ -677,16 +662,11 @@ test if-6.3 {if cmd with computed command names: missing expression after "elsei catch {$z 1<2 {set a 1} elseif} msg set msg } {wrong # args: no expression after "elseif" argument} -test if-6.4 {if cmd with computed command names: error in expression after "elseif"} { +test if-6.4 {if cmd with computed command names: error in expression after "elseif"} -body { set z if set a {} list [catch {$z 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo -} {1 {missing operand at _@_ -in expression "1>_@_"} {missing operand at _@_ -in expression "1>_@_" - (parsing expression "1>") - invoked from within -"$z 3>4 {set a 1} elseif {1>}"}} +} -match glob -result {1 * {*"$z 3>4 {set a 1} elseif {1>}"}} test if-6.5 {if cmd with computed command names: test jumpFalse instruction replacement after long "elseif" body} { set z if catch {unset i} @@ -1094,7 +1074,7 @@ test if-10.5 {substituted control words} { set elseif elseif; proc elseif {} {return badelseif} list [catch {if 1 $then {if 0 {} $elseif 1 {if 0 {} $else {list ok}}}} a] $a } {0 ok} -test if-10.6 {double invocation of variable traces} { +test if-10.6 {double invocation of variable traces} -body { set iftracecounter 0 proc iftraceproc {args} { upvar #0 iftracecounter counter @@ -1112,9 +1092,7 @@ test if-10.6 {double invocation of variable traces} { list [catch {if "$iftracevar + 20" {}} a] $a \ [catch {if "$iftracevar + 20" {}} b] $b \ [unset iftracevar iftracecounter] -} {1 {invalid bareword "oops" -in expression "1 oops 10 + 20"; -should be "$oops" or "{oops}" or "oops(...)" or ...} 0 {} {}} +} -match glob -result {1 {*} 0 {} {}} # cleanup ::tcltest::cleanupTests |