summaryrefslogtreecommitdiffstats
path: root/tests/if.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/if.test')
-rw-r--r--tests/if.test16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/if.test b/tests/if.test
index aec98f4..8a4ebf1 100644
--- a/tests/if.test
+++ b/tests/if.test
@@ -10,13 +10,17 @@
# 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.8 2004/09/26 16:36:06 msofer Exp $
+# RCS: @(#) $Id: if.test,v 1.9 2006/08/02 20:03:37 das Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
namespace import -force ::tcltest::*
}
+# Constraint set on tests that depend on the exact format of the error messages
+# of the pre-2006/07/05 expression parser (-DOLD_EXPR_PARSER=1)
+testConstraint oldExprParser [expr {![testConstraint newExprParser]}]
+
# Basic "if" operation.
catch {unset a}
@@ -26,7 +30,7 @@ test if-1.1 {TclCompileIfCmd: missing if/elseif test} {
test if-1.2 {TclCompileIfCmd: error in if/elseif test} {
list [catch {if {[error "error in condition"]} foo} msg] $msg
} {1 {error in condition}}
-test if-1.3 {TclCompileIfCmd: error in if/elseif test} -body {
+test if-1.3 {TclCompileIfCmd: error in if/elseif test} -constraints {oldExprParser} -body {
list [catch {if {1+}} msg] $msg $errorInfo
} -match glob -result {1 {syntax error in expression "1+": premature end of expression} {syntax error in expression "1+": premature end of expression*
while *ing
@@ -173,7 +177,7 @@ test if-2.3 {TclCompileIfCmd: missing expression after "elseif"} {
catch {if 1<2 {set a 1} elseif} msg
set msg
} {wrong # args: no expression after "elseif" argument}
-test if-2.4 {TclCompileIfCmd: error in expression after "elseif"} -body {
+test if-2.4 {TclCompileIfCmd: error in expression after "elseif"} -constraints {oldExprParser} -body {
set a {}
list [catch {if 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo
} -match glob -result {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression*
@@ -501,7 +505,7 @@ 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} {oldExprParser} {
set z if
list [catch {$z {1+}} msg] $msg $errorInfo
} {1 {syntax error in expression "1+": premature end of expression} {syntax error in expression "1+": premature end of expression
@@ -668,7 +672,7 @@ 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"} {oldExprParser} {
set z if
set a {}
list [catch {$z 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo
@@ -1082,7 +1086,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} {oldExprParser} {
set iftracecounter 0
proc iftraceproc {args} {
upvar #0 iftracecounter counter