From 1cb22227799972e31fd2e85ec0bc738dd5e176be Mon Sep 17 00:00:00 2001 From: das Date: Wed, 2 Aug 2006 20:03:37 +0000 Subject: * tests/compExpr-old.test: add 'oldExprParser' constraint to all tests * tests/compExpr.test: that depend on the exact format of the error * tests/compile.test: messages of the pre-2006-07-05 expression * tests/expr-old.test: parser. The constraint is on by default (i.e. * tests/expr.test: those test still fail), but it can be turned * tests/for.test: off by passing '-constraints newExprParser' * tests/if.test: to tcltest, which will skip the 196 failing * tests/parseExpr.test: tests in the testsuite that are caused by * tests/while.test: the new expression parser error messages. --- tests/compExpr-old.test | 90 +++++++++++++++++----------------- tests/compExpr.test | 30 +++++++----- tests/compile.test | 12 +++-- tests/expr-old.test | 52 +++++++++++--------- tests/expr.test | 126 +++++++++++++++++++++++++----------------------- tests/for.test | 8 ++- tests/if.test | 16 +++--- tests/parseExpr.test | 102 ++++++++++++++++++++------------------- tests/while.test | 10 ++-- 9 files changed, 241 insertions(+), 205 deletions(-) diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test index c5bbb78..ef8b1ca 100644 --- a/tests/compExpr-old.test +++ b/tests/compExpr-old.test @@ -12,13 +12,17 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr-old.test,v 1.18 2006/04/06 18:19:24 dgp Exp $ +# RCS: @(#) $Id: compExpr-old.test,v 1.19 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]}] + if {[catch {expr T1()} msg] && $msg eq {invalid command name "tcl::mathfunc::T1"}} { testConstraint testmathfunctions 0 } else { @@ -193,11 +197,11 @@ test compExpr-old-1.14 {TclCompileExprCmd: second level of substitutions in expr test compExpr-old-2.1 {TclCompileExpr: are builtin functions registered?} { expr double(5*[llength "6 2"]) } 10.0 -test compExpr-old-2.2 {TclCompileExpr: error in expr} { +test compExpr-old-2.2 {TclCompileExpr: error in expr} {oldExprParser} { catch {expr 2***3} msg set msg } {syntax error in expression "2***3": unexpected operator *} -test compExpr-old-2.3 {TclCompileExpr: junk after legal expr} { +test compExpr-old-2.3 {TclCompileExpr: junk after legal expr} {oldExprParser} { catch {expr 7*[llength "a b"]foo} msg set msg } {syntax error in expression "7*2foo": extra tokens at end of expression} @@ -206,18 +210,18 @@ test compExpr-old-2.4 {TclCompileExpr: numeric expr string rep == formatted int } 1 test compExpr-old-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1 -test compExpr-old-3.2 {CompileCondExpr: error in lor expr} -body { +test compExpr-old-3.2 {CompileCondExpr: error in lor expr} -constraints {oldExprParser} -body { catch {expr x||3} msg set msg } -match glob \ -result {syntax error in expression "x||3": * preceding $*} test compExpr-old-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44 -test compExpr-old-3.4 {CompileCondExpr: error compiling true arm} { +test compExpr-old-3.4 {CompileCondExpr: error compiling true arm} {oldExprParser} { catch {expr 3>2?2***3:66} msg set msg } {syntax error in expression "3>2?2***3:66": unexpected operator *} test compExpr-old-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66 -test compExpr-old-3.6 {CompileCondExpr: error compiling false arm} { +test compExpr-old-3.6 {CompileCondExpr: error compiling false arm} {oldExprParser} { catch {expr 2>3?44:2***3} msg set msg } {syntax error in expression "2>3?44:2***3": unexpected operator *} @@ -230,18 +234,18 @@ test compExpr-old-3.8 {CompileCondExpr: long arms & nested cond exprs} unix { } 2358 test compExpr-old-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1 -test compExpr-old-4.2 {CompileLorExpr: error in land expr} -body { +test compExpr-old-4.2 {CompileLorExpr: error in land expr} -constraints {oldExprParser} -body { catch {expr x&&3} msg set msg } -match glob -result {syntax error in expression "x&&3": * preceding $*} test compExpr-old-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1 test compExpr-old-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1 test compExpr-old-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1 -test compExpr-old-4.6 {CompileLorExpr: error compiling lor arm} { +test compExpr-old-4.6 {CompileLorExpr: error compiling lor arm} {oldExprParser} { catch {expr 2***3||4.0} msg set msg } {syntax error in expression "2***3||4.0": unexpected operator *} -test compExpr-old-4.7 {CompileLorExpr: error compiling lor arm} { +test compExpr-old-4.7 {CompileLorExpr: error compiling lor arm} {oldExprParser} { catch {expr 1.3||2***3} msg set msg } {syntax error in expression "1.3||2***3": unexpected operator *} @@ -255,7 +259,7 @@ test compExpr-old-4.9 {CompileLorExpr: long lor arm} { } 1 test compExpr-old-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23 -test compExpr-old-5.2 {CompileLandExpr: error in bitor expr} -body { +test compExpr-old-5.2 {CompileLandExpr: error in bitor expr} -constraints {oldExprParser} -body { catch {expr x|3} msg set msg } -match glob -result {syntax error in expression "x|3": * preceding $*} @@ -263,11 +267,11 @@ test compExpr-old-5.3 {CompileLandExpr: simple land exprs} {expr 0&&1.0} 0 test compExpr-old-5.4 {CompileLandExpr: simple land exprs} {expr 0&&0} 0 test compExpr-old-5.5 {CompileLandExpr: simple land exprs} {expr 3.0&&1.2} 1 test compExpr-old-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1 -test compExpr-old-5.7 {CompileLandExpr: error compiling land arm} { +test compExpr-old-5.7 {CompileLandExpr: error compiling land arm} {oldExprParser} { catch {expr 2***3&&4.0} msg set msg } {syntax error in expression "2***3&&4.0": unexpected operator *} -test compExpr-old-5.8 {CompileLandExpr: error compiling land arm} { +test compExpr-old-5.8 {CompileLandExpr: error compiling land arm} {oldExprParser} { catch {expr 1.3&&2***3} msg set msg } {syntax error in expression "1.3&&2***3": unexpected operator *} @@ -281,7 +285,7 @@ test compExpr-old-5.10 {CompileLandExpr: long land arms} { } 1 test compExpr-old-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3 -test compExpr-old-6.2 {CompileBitXorExpr: error in bitand expr} -body { +test compExpr-old-6.2 {CompileBitXorExpr: error in bitand expr} -constraints {oldExprParser} -body { catch {expr x|3} msg set msg } -match glob -result {syntax error in expression "x|3": * preceding $*} @@ -289,11 +293,11 @@ test compExpr-old-6.3 {CompileBitXorExpr: simple bitxor exprs} {expr 7^0x13} 20 test compExpr-old-6.4 {CompileBitXorExpr: simple bitxor exprs} {expr 3^0x10} 19 test compExpr-old-6.5 {CompileBitXorExpr: simple bitxor exprs} {expr 0^7} 7 test compExpr-old-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8 -test compExpr-old-6.7 {CompileBitXorExpr: error compiling bitxor arm} { +test compExpr-old-6.7 {CompileBitXorExpr: error compiling bitxor arm} {oldExprParser} { catch {expr 2***3|6} msg set msg } {syntax error in expression "2***3|6": unexpected operator *} -test compExpr-old-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body { +test compExpr-old-6.8 {CompileBitXorExpr: error compiling bitxor arm} -constraints {oldExprParser} -body { catch {expr 2^x} msg set msg } -match glob -result {syntax error in expression "2^x": * preceding $*} @@ -308,7 +312,7 @@ test compExpr-old-7.1 {CompileBitAndExpr: just equality expr} {expr 3==2} 0 test compExpr-old-7.2 {CompileBitAndExpr: just equality expr} {expr 2.0==2} 1 test compExpr-old-7.3 {CompileBitAndExpr: just equality expr} {expr 3.2!=2.2} 1 test compExpr-old-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0 -test compExpr-old-7.5 {CompileBitAndExpr: error in equality expr} -body { +test compExpr-old-7.5 {CompileBitAndExpr: error in equality expr} -constraints {oldExprParser} -body { catch {expr x==3} msg set msg } -match glob -result {syntax error in expression "x==3": * preceding $*} @@ -316,11 +320,11 @@ test compExpr-old-7.6 {CompileBitAndExpr: simple bitand exprs} {expr 7&0x13} 3 test compExpr-old-7.7 {CompileBitAndExpr: simple bitand exprs} {expr 0xf2&0x53} 82 test compExpr-old-7.8 {CompileBitAndExpr: simple bitand exprs} {expr 3&6} 2 test compExpr-old-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7 -test compExpr-old-7.10 {CompileBitAndExpr: error compiling bitand arm} { +test compExpr-old-7.10 {CompileBitAndExpr: error compiling bitand arm} {oldExprParser} { catch {expr 2***3&6} msg set msg } {syntax error in expression "2***3&6": unexpected operator *} -test compExpr-old-7.11 {CompileBitAndExpr: error compiling bitand arm} -body { +test compExpr-old-7.11 {CompileBitAndExpr: error compiling bitand arm} -constraints {oldExprParser} -body { catch {expr 2&x} msg set msg } -match glob -result {syntax error in expression "2&x": * preceding $*} @@ -335,7 +339,7 @@ test compExpr-old-8.1 {CompileEqualityExpr: just relational expr} {expr 3>=2} 1 test compExpr-old-8.2 {CompileEqualityExpr: just relational expr} {expr 2<=2.1} 1 test compExpr-old-8.3 {CompileEqualityExpr: just relational expr} {expr 3.2>"2.2"} 1 test compExpr-old-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0 -test compExpr-old-8.5 {CompileEqualityExpr: error in relational expr} -body { +test compExpr-old-8.5 {CompileEqualityExpr: error in relational expr} -constraints {oldExprParser} -body { catch {expr x>3} msg set msg } -match glob -result {syntax error in expression "x>3": * preceding $*} @@ -343,11 +347,11 @@ test compExpr-old-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13 test compExpr-old-8.7 {CompileEqualityExpr: simple equality exprs} {expr -0xf2!=0x53} 1 test compExpr-old-8.8 {CompileEqualityExpr: simple equality exprs} {expr {"12398712938788234-1298379" != ""}} 1 test compExpr-old-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1 -test compExpr-old-8.10 {CompileEqualityExpr: error compiling equality arm} { +test compExpr-old-8.10 {CompileEqualityExpr: error compiling equality arm} {oldExprParser} { catch {expr 2***3==6} msg set msg } {syntax error in expression "2***3==6": unexpected operator *} -test compExpr-old-8.11 {CompileEqualityExpr: error compiling equality arm} -body { +test compExpr-old-8.11 {CompileEqualityExpr: error compiling equality arm} -constraints {oldExprParser} -body { catch {expr 2!=x} msg set msg } -match glob -result {syntax error in expression "2!=x": * preceding $*} @@ -368,17 +372,17 @@ test compExpr-old-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} lo expr {int(1<<31)} } -2147483648 -test compExpr-old-9.6 {CompileRelationalExpr: error in shift expr} -body { +test compExpr-old-9.6 {CompileRelationalExpr: error in shift expr} -constraints {oldExprParser} -body { catch {expr x>>3} msg set msg } -match glob -result {syntax error in expression "x>>3": * preceding $*} test compExpr-old-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1 test compExpr-old-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1 -test compExpr-old-9.9 {CompileRelationalExpr: error compiling relational arm} { +test compExpr-old-9.9 {CompileRelationalExpr: error compiling relational arm} {oldExprParser} { catch {expr 2***3>6} msg set msg } {syntax error in expression "2***3>6": unexpected operator *} -test compExpr-old-9.10 {CompileRelationalExpr: error compiling relational arm} -body { +test compExpr-old-9.10 {CompileRelationalExpr: error compiling relational arm} -constraints {oldExprParser} -body { catch {expr 2>0x3} 31 test compExpr-old-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936 -test compExpr-old-10.8 {CompileShiftExpr: error compiling shift arm} { +test compExpr-old-10.8 {CompileShiftExpr: error compiling shift arm} {oldExprParser} { catch {expr 2***3>>6} msg set msg } {syntax error in expression "2***3>>6": unexpected operator *} -test compExpr-old-10.9 {CompileShiftExpr: error compiling shift arm} -body { +test compExpr-old-10.9 {CompileShiftExpr: error compiling shift arm} -constraints {oldExprParser} -body { catch {expr 2< 0) ? round(log($x)) : 0}} msg] $msg } {0 0} -test expr-old-27.11 {cancelled evaluation} -body { +test expr-old-27.11 {cancelled evaluation} -constraints {oldExprParser} -body { list [catch {expr {0 && foo}} msg] $msg } -match glob -result {1 {syntax error in expression "0 && foo": * preceding $*}} -test expr-old-27.12 {cancelled evaluation} -body { +test expr-old-27.12 {cancelled evaluation} -constraints {oldExprParser} -body { list [catch {expr {0 ? 1 : foo}} msg] $msg } -match glob -result {1 {syntax error in expression "0 ? 1 : foo": * preceding $*}} @@ -681,7 +685,7 @@ test expr-old-29.1 {braces} {expr {{abc}}} abc test expr-old-29.2 {braces} {expr {{00010}}} 8 test expr-old-29.3 {braces} {expr {{3.1200000}}} 3.12 test expr-old-29.4 {braces} {expr {{a{b}{1 {2 3}}c}}} "a{b}{1 {2 3}}c" -test expr-old-29.5 {braces} { +test expr-old-29.5 {braces} {oldExprParser} { list [catch {expr "\{abc"} msg] $msg } {1 {missing close-brace}} @@ -704,13 +708,13 @@ test expr-old-30.2 {long values} { test expr-old-31.1 {multiple arguments to expr command} { expr 4 + ( 6 *12) -3 } 73 -test expr-old-31.2 {multiple arguments to expr command} { +test expr-old-31.2 {multiple arguments to expr command} {oldExprParser} { list [catch {expr 2 + (3 + 4} msg] $msg } {1 {syntax error in expression "2 + (3 + 4": looking for close parenthesis}} -test expr-old-31.3 {multiple arguments to expr command} { +test expr-old-31.3 {multiple arguments to expr command} {oldExprParser} { list [catch {expr 2 + 3 +} msg] $msg } {1 {syntax error in expression "2 + 3 +": premature end of expression}} -test expr-old-31.4 {multiple arguments to expr command} { +test expr-old-31.4 {multiple arguments to expr command} {oldExprParser} { list [catch {expr 2 + 3 )} msg] $msg } {1 {syntax error in expression "2 + 3 )": extra tokens at end of expression}} @@ -902,19 +906,19 @@ test expr-old-33.4 {conversions and fancy args to math functions} { test expr-old-34.1 {errors in math functions} -body { list [catch {expr func_2(1.0)} msg] $msg } -match glob -result {1 {* "*func_2"}} -test expr-old-34.2 {errors in math functions} -body { +test expr-old-34.2 {errors in math functions} -constraints {oldExprParser} -body { list [catch {expr func|(1.0)} msg] $msg } -match glob -result {1 {syntax error in expression "func|(1.0)": * preceding $*}} test expr-old-34.3 {errors in math functions} { list [catch {expr {hypot("a b", 2.0)}} msg] $msg } {1 {expected floating-point number but got "a b"}} -test expr-old-34.4 {errors in math functions} { +test expr-old-34.4 {errors in math functions} {oldExprParser} { list [catch {expr hypot(1.0 2.0)} msg] $msg } {1 {syntax error in expression "hypot(1.0 2.0)": missing close parenthesis at end of function call}} -test expr-old-34.5 {errors in math functions} { +test expr-old-34.5 {errors in math functions} {oldExprParser} { list [catch {expr hypot(1.0, 2.0} msg] $msg } {1 {syntax error in expression "hypot(1.0, 2.0": missing close parenthesis at end of function call}} -test expr-old-34.6 {errors in math functions} { +test expr-old-34.6 {errors in math functions} {oldExprParser} { list [catch {expr hypot(1.0 ,} msg] $msg } {1 {syntax error in expression "hypot(1.0 ,": premature end of expression}} test expr-old-34.7 {errors in math functions} -body { @@ -989,7 +993,7 @@ test expr-old-36.8 {ExprLooksLikeInt procedure} { test expr-old-36.9 {ExprLooksLikeInt procedure} { list [catch {expr 24E1} msg] $msg } {0 240.0} -test expr-old-36.10 {ExprLooksLikeInt procedure} -body { +test expr-old-36.10 {ExprLooksLikeInt procedure} -constraints {oldExprParser} -body { expr 78e } -returnCodes error -match glob -result {syntax error in expression "78e"*} @@ -1118,11 +1122,11 @@ test expr-old-37.24 {Tcl_ExprDouble handles overflows that look like int} \ testexprdouble 17976931348623165[string repeat 0 292] } {This is a result: Inf} test expr-old-37.25 {Tcl_ExprDouble and NaN} \ - {ieeeFloatingPoint testexprdouble} { + {ieeeFloatingPoint testexprdouble oldExprParser} { list [catch {testexprdouble 0.0/0.0} result] $result } {1 {floating point value is Not a Number}} -test expr-old-38.1 {Verify Tcl_ExprString's basic operation} testexprstring { +test expr-old-38.1 {Verify Tcl_ExprString's basic operation} {testexprstring oldExprParser} { list [testexprstring "1+4"] [testexprstring "2*3+4.2"] \ [catch {testexprstring "1+"} msg] $msg } {5 10.2 1 {syntax error in expression "1+": premature end of expression}} diff --git a/tests/expr.test b/tests/expr.test index faca569..ef84607 100644 --- a/tests/expr.test +++ b/tests/expr.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: expr.test,v 1.56 2006/07/26 21:56:35 dgp Exp $ +# RCS: @(#) $Id: expr.test,v 1.57 2006/08/02 20:03:37 das Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 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]}] + testConstraint testmathfunctions [expr { ([catch {expr T1()} msg] != 1) || ($msg ne {invalid command name "tcl::mathfunc::T1"}) }] @@ -203,11 +207,11 @@ test expr-1.15 {TclCompileExprCmd: second level of substitutions in expr with co test expr-2.1 {TclCompileExpr: are builtin functions registered?} { expr double(5*[llength "6 2"]) } 10.0 -test expr-2.2 {TclCompileExpr: error in expr} { +test expr-2.2 {TclCompileExpr: error in expr} {oldExprParser} { catch {expr 2***3} msg set msg } {syntax error in expression "2***3": unexpected operator *} -test expr-2.3 {TclCompileExpr: junk after legal expr} { +test expr-2.3 {TclCompileExpr: junk after legal expr} {oldExprParser} { catch {expr 7*[llength "a b"]foo} msg set msg } {syntax error in expression "7*2foo": extra tokens at end of expression} @@ -216,17 +220,17 @@ test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} { } 1 test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1 -test expr-3.2 {CompileCondExpr: error in lor expr} -body { +test expr-3.2 {CompileCondExpr: error in lor expr} -constraints {oldExprParser} -body { catch {expr x||3} msg set msg } -match glob -result {syntax error in expression "x||3": * preceding $*} test expr-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44 -test expr-3.4 {CompileCondExpr: error compiling true arm} { +test expr-3.4 {CompileCondExpr: error compiling true arm} {oldExprParser} { catch {expr 3>2?2***3:66} msg set msg } {syntax error in expression "3>2?2***3:66": unexpected operator *} test expr-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66 -test expr-3.6 {CompileCondExpr: error compiling false arm} { +test expr-3.6 {CompileCondExpr: error compiling false arm} {oldExprParser} { catch {expr 2>3?44:2***3} msg set msg } {syntax error in expression "2>3?44:2***3": unexpected operator *} @@ -239,18 +243,18 @@ test expr-3.8 {CompileCondExpr: long arms & nested cond exprs} unix { } 2358 test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1 -test expr-4.2 {CompileLorExpr: error in land expr} -body { +test expr-4.2 {CompileLorExpr: error in land expr} -constraints {oldExprParser} -body { catch {expr x&&3} msg set msg } -match glob -result {syntax error in expression "x&&3": *preceding $*} test expr-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1 test expr-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1 test expr-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1 -test expr-4.6 {CompileLorExpr: error compiling lor arm} { +test expr-4.6 {CompileLorExpr: error compiling lor arm} {oldExprParser} { catch {expr 2***3||4.0} msg set msg } {syntax error in expression "2***3||4.0": unexpected operator *} -test expr-4.7 {CompileLorExpr: error compiling lor arm} { +test expr-4.7 {CompileLorExpr: error compiling lor arm} {oldExprParser} { catch {expr 1.3||2***3} msg set msg } {syntax error in expression "1.3||2***3": unexpected operator *} @@ -273,7 +277,7 @@ test expr-4.12 {CompileLorExpr: error compiling land arms} { } {1 {expected boolean value but got "a"}} test expr-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23 -test expr-5.2 {CompileLandExpr: error in bitor expr} -body { +test expr-5.2 {CompileLandExpr: error in bitor expr} -constraints {oldExprParser} -body { catch {expr x|3} msg set msg } -match glob -result {syntax error in expression "x|3": * preceding $*} @@ -281,11 +285,11 @@ test expr-5.3 {CompileLandExpr: simple land exprs} {expr 0&&1.0} 0 test expr-5.4 {CompileLandExpr: simple land exprs} {expr 0&&0} 0 test expr-5.5 {CompileLandExpr: simple land exprs} {expr 3.0&&1.2} 1 test expr-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1 -test expr-5.7 {CompileLandExpr: error compiling land arm} { +test expr-5.7 {CompileLandExpr: error compiling land arm} {oldExprParser} { catch {expr 2***3&&4.0} msg set msg } {syntax error in expression "2***3&&4.0": unexpected operator *} -test expr-5.8 {CompileLandExpr: error compiling land arm} { +test expr-5.8 {CompileLandExpr: error compiling land arm} {oldExprParser} { catch {expr 1.3&&2***3} msg set msg } {syntax error in expression "1.3&&2***3": unexpected operator *} @@ -299,7 +303,7 @@ test expr-5.10 {CompileLandExpr: long land arms} { } 1 test expr-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3 -test expr-6.2 {CompileBitXorExpr: error in bitand expr} -body { +test expr-6.2 {CompileBitXorExpr: error in bitand expr} -constraints {oldExprParser} -body { catch {expr x|3} msg set msg } -match glob -result {syntax error in expression "x|3": * preceding $*} @@ -307,11 +311,11 @@ test expr-6.3 {CompileBitXorExpr: simple bitxor exprs} {expr 7^0x13} 20 test expr-6.4 {CompileBitXorExpr: simple bitxor exprs} {expr 3^0x10} 19 test expr-6.5 {CompileBitXorExpr: simple bitxor exprs} {expr 0^7} 7 test expr-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8 -test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} { +test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} {oldExprParser} { catch {expr 2***3|6} msg set msg } {syntax error in expression "2***3|6": unexpected operator *} -test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body { +test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} -constraints {oldExprParser} -body { catch {expr 2^x} msg set msg } -match glob -result {syntax error in expression "2^x": * preceding $**} @@ -326,7 +330,7 @@ test expr-7.1 {CompileBitAndExpr: just equality expr} {expr 3==2} 0 test expr-7.2 {CompileBitAndExpr: just equality expr} {expr 2.0==2} 1 test expr-7.3 {CompileBitAndExpr: just equality expr} {expr 3.2!=2.2} 1 test expr-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0 -test expr-7.5 {CompileBitAndExpr: error in equality expr} -body { +test expr-7.5 {CompileBitAndExpr: error in equality expr} -constraints {oldExprParser} -body { catch {expr x==3} msg set msg } -match glob -result {syntax error in expression "x==3": * preceding $*} @@ -334,11 +338,11 @@ test expr-7.6 {CompileBitAndExpr: simple bitand exprs} {expr 7&0x13} 3 test expr-7.7 {CompileBitAndExpr: simple bitand exprs} {expr 0xf2&0x53} 82 test expr-7.8 {CompileBitAndExpr: simple bitand exprs} {expr 3&6} 2 test expr-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7 -test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} { +test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} {oldExprParser} { catch {expr 2***3&6} msg set msg } {syntax error in expression "2***3&6": unexpected operator *} -test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} -body { +test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} -constraints {oldExprParser} -body { catch {expr 2&x} msg set msg } -match glob -result {syntax error in expression "2&x": * preceding $*} @@ -350,7 +354,7 @@ test expr-7.13 {CompileBitAndExpr: runtime error in bitand arm} { } {1 {can't use non-numeric string as operand of "&"}} test expr-7.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0 test expr-7.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0 -test expr-7.20 {CompileBitAndExpr: error in equality expr} -body { +test expr-7.20 {CompileBitAndExpr: error in equality expr} -constraints {oldExprParser} -body { catch {expr xne3} msg set msg } -match glob -result {syntax error in expression "xne3": * preceding $*} @@ -359,7 +363,7 @@ test expr-8.1 {CompileEqualityExpr: just relational expr} {expr 3>=2} 1 test expr-8.2 {CompileEqualityExpr: just relational expr} {expr 2<=2.1} 1 test expr-8.3 {CompileEqualityExpr: just relational expr} {expr 3.2>"2.2"} 1 test expr-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0 -test expr-8.5 {CompileEqualityExpr: error in relational expr} -body { +test expr-8.5 {CompileEqualityExpr: error in relational expr} -constraints {oldExprParser} -body { catch {expr x>3} msg set msg } -match glob -result {syntax error in expression "x>3": * preceding $*} @@ -367,11 +371,11 @@ test expr-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13} 0 test expr-8.7 {CompileEqualityExpr: simple equality exprs} {expr -0xf2!=0x53} 1 test expr-8.8 {CompileEqualityExpr: simple equality exprs} {expr {"12398712938788234-1298379" != ""}} 1 test expr-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1 -test expr-8.10 {CompileEqualityExpr: error compiling equality arm} { +test expr-8.10 {CompileEqualityExpr: error compiling equality arm} {oldExprParser} { catch {expr 2***3==6} msg set msg } {syntax error in expression "2***3==6": unexpected operator *} -test expr-8.11 {CompileEqualityExpr: error compiling equality arm} -body { +test expr-8.11 {CompileEqualityExpr: error compiling equality arm} -constraints {oldExprParser} -body { catch {expr 2!=x} msg set msg } -match glob -result {syntax error in expression "2!=x": * preceding $*} @@ -383,20 +387,20 @@ test expr-8.16 {CompileBitAndExpr: equality expr} {expr 3.2ne2.2} 1 test expr-8.17 {CompileBitAndExpr: equality expr} {expr 01eq1} 0 test expr-8.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0 test expr-8.19 {CompileBitAndExpr: equality expr} {expr {"abc" ne "abd"}} 1 -test expr-8.20 {CompileBitAndExpr: error in equality expr} -body { +test expr-8.20 {CompileBitAndExpr: error in equality expr} -constraints {oldExprParser} -body { catch {expr x ne3} msg set msg } -match glob -result {syntax error in expression "x ne3": * preceding $*} -test expr-8.21 {CompileBitAndExpr: error in equality expr} -body { +test expr-8.21 {CompileBitAndExpr: error in equality expr} -constraints {oldExprParser} -body { # These should be ""ed to avoid the error catch {expr a eq b} msg set msg } -match glob -result {syntax error in expression "a eq b": * preceding $*} -test expr-8.22 {CompileBitAndExpr: error in equality expr} { +test expr-8.22 {CompileBitAndExpr: error in equality expr} {oldExprParser} { catch {expr {false eqfalse}} msg set msg } {syntax error in expression "false eqfalse": extra tokens at end of expression} -test expr-8.23 {CompileBitAndExpr: error in equality expr} { +test expr-8.23 {CompileBitAndExpr: error in equality expr} {oldExprParser} { catch {expr {false nefalse}} msg set msg } {syntax error in expression "false nefalse": extra tokens at end of expression} @@ -425,19 +429,19 @@ test expr-8.29 {CompileEqualityExpr: just relational expr} { test expr-8.30 {CompileEqualityExpr: simple equality exprs} { expr {"fake" != "bob"} } 1 -test expr-8.31 {expr edge cases} { +test expr-8.31 {expr edge cases} {oldExprParser} { list [catch {expr {1e}} err] $err } {1 {syntax error in expression "1e": extra tokens at end of expression}} -test expr-8.32 {expr edge cases} { +test expr-8.32 {expr edge cases} {oldExprParser} { list [catch {expr {1E}} err] $err } {1 {syntax error in expression "1E": extra tokens at end of expression}} -test expr-8.33 {expr edge cases} { +test expr-8.33 {expr edge cases} {oldExprParser} { list [catch {expr {1e+}} err] $err } {1 {syntax error in expression "1e+": extra tokens at end of expression}} -test expr-8.34 {expr edge cases} { +test expr-8.34 {expr edge cases} {oldExprParser} { list [catch {expr {1E+}} err] $err } {1 {syntax error in expression "1E+": extra tokens at end of expression}} -test expr-8.35 {expr edge cases} { +test expr-8.35 {expr edge cases} {oldExprParser} { list [catch {expr {1ea}} err] $err } {1 {syntax error in expression "1ea": extra tokens at end of expression}} @@ -451,17 +455,17 @@ test expr-9.5a {CompileRelationalExpr: shift expr producing LONG_MIN} longIs64bi test expr-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} longIs32bit { expr {int(1<<31)} } -2147483648 -test expr-9.6 {CompileRelationalExpr: error in shift expr} -body { +test expr-9.6 {CompileRelationalExpr: error in shift expr} -constraints {oldExprParser} -body { catch {expr x>>3} msg set msg } -match glob -result {syntax error in expression "x>>3": * preceding $*} test expr-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1 test expr-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1 -test expr-9.9 {CompileRelationalExpr: error compiling relational arm} { +test expr-9.9 {CompileRelationalExpr: error compiling relational arm} {oldExprParser} { catch {expr 2***3>6} msg set msg } {syntax error in expression "2***3>6": unexpected operator *} -test expr-9.10 {CompileRelationalExpr: error compiling relational arm} -body { +test expr-9.10 {CompileRelationalExpr: error compiling relational arm} -constraints {oldExprParser} -body { catch {expr 2>0x3} 31 test expr-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936 -test expr-10.8 {CompileShiftExpr: error compiling shift arm} { +test expr-10.8 {CompileShiftExpr: error compiling shift arm} {oldExprParser} { catch {expr 2***3>>6} msg set msg } {syntax error in expression "2***3>>6": unexpected operator *} -test expr-10.9 {CompileShiftExpr: error compiling shift arm} -body { +test expr-10.9 {CompileShiftExpr: error compiling shift arm} -constraints {oldExprParser} -body { catch {expr 2<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 diff --git a/tests/parseExpr.test b/tests/parseExpr.test index 7deb551..4e5c926 100644 --- a/tests/parseExpr.test +++ b/tests/parseExpr.test @@ -8,13 +8,17 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: parseExpr.test,v 1.22 2006/07/05 05:34:45 dgp Exp $ +# RCS: @(#) $Id: parseExpr.test,v 1.23 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]}] + # Note that the Tcl expression parser (tclParseExpr.c) does not check # the semantic validity of the expressions it parses. It does not check, # for example, that a math function actually exists, or that the operands @@ -97,11 +101,11 @@ test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {test list [catch {testexprparser {12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {foo+} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "foo+": *preceding $*}} -test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} testexprparser { +test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} {testexprparser oldExprParser} { list [catch {testexprparser {1+2 345} -1} msg] $msg } {1 {syntax error in expression "1+2 345": extra tokens at end of expression}} @@ -109,7 +113,7 @@ test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} testexprparser testexprparser {2>3? 1 : 0} -1 } {- {} 0 subexpr {2>3? 1 : 0} 11 operator ? 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {0 || foo} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "0 || foo": * preceding $*}} @@ -126,18 +130,18 @@ test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} testexp testexprparser {1? 3 : 4} -1 } {- {} 0 subexpr {1? 3 : 4} 7 operator ? 0 subexpr 1 1 text 1 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1? fred : martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1? fred : martha": *preceding $*}} -test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} testexprparser { +test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} {testexprparser oldExprParser} { list [catch {testexprparser {1? 2 martha 3} -1} msg] $msg } {1 {syntax error in expression "1? 2 martha 3": missing colon from ternary conditional}} test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} testexprparser { testexprparser {27||3? 3 : 4&&9} -1 } {- {} 0 subexpr {27||3? 3 : 4&&9} 15 operator ? 0 subexpr 27||3 5 operator || 0 subexpr 27 1 text 27 0 subexpr 3 1 text 3 0 subexpr 3 1 text 3 0 subexpr 4&&9 5 operator && 0 subexpr 4 1 text 4 0 subexpr 9 1 text 9 0 {}} test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1? 2 : martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1? 2 : martha": * preceding $*}} @@ -146,7 +150,7 @@ test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} testexprp testexprparser {1&&2 || 3} -1 } {- {} 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1&&foo || 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1&&foo || 3": * preceding $*}} @@ -163,7 +167,7 @@ test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} testexprpar testexprparser {1&&2 || 3 || 4} -1 } {- {} 0 subexpr {1&&2 || 3 || 4} 13 operator || 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1&&2 || 3 || martha": * preceding $*}} @@ -172,7 +176,7 @@ test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} testexprpars testexprparser {1|2 && 3} -1 } {- {} 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1&&foo && 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1&&foo && 3": * preceding $*}} @@ -189,7 +193,7 @@ test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} testexprpa testexprparser {1|2 && 3 && 4} -1 } {- {} 0 subexpr {1|2 && 3 && 4} 13 operator && 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1|2 && 3 && martha": * preceding $*}} @@ -198,7 +202,7 @@ test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} testexprpar testexprparser {1^2 | 3} -1 } {- {} 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1|foo | 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1|foo | 3": * preceding $*}} @@ -215,7 +219,7 @@ test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} testexprp testexprparser {1^2 | 3 | 4} -1 } {- {} 0 subexpr {1^2 | 3 | 4} 13 operator | 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1^2 | 3 | martha": * preceding $*}} @@ -224,7 +228,7 @@ test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} testexprpa testexprparser {1&2 ^ 3} -1 } {- {} 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1^foo ^ 3": * preceding $*}} @@ -241,7 +245,7 @@ test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} testexpr testexprparser {1&2 ^ 3 ^ 4} -1 } {- {} 0 subexpr {1&2 ^ 3 ^ 4} 13 operator ^ 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1&2 ^ 3 ^ martha": * preceding $*}} @@ -250,7 +254,7 @@ test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} teste testexprparser {1==2 & 3} -1 } {- {} 0 subexpr {1==2 & 3} 9 operator & 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1!=foo & 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1!=foo & 3": * preceding $*}} @@ -267,7 +271,7 @@ test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} testexpr testexprparser {1<2 & 3 & 4} -1 } {- {} 0 subexpr {1<2 & 3 & 4} 13 operator & 0 subexpr {1<2 & 3} 9 operator & 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1==2 & 3>2 & martha": * preceding $*}} @@ -276,7 +280,7 @@ test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} t testexprparser {1<2 == 3} -1 } {- {} 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1>=foo == 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1>=foo == 3": * preceding $*}} @@ -296,7 +300,7 @@ test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} testex testexprparser {1<2 == 3 == 4} -1 } {- {} 0 subexpr {1<2 == 3 == 4} 13 operator == 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1<2 == 3 != martha": * preceding $*}} @@ -305,7 +309,7 @@ test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} test testexprparser {1<<2 < 3} -1 } {- {} 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1>=foo < 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1>=foo < 3": * preceding $*}} @@ -331,7 +335,7 @@ test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} test testexprparser {1<<2 < 3 < 4} -1 } {- {} 0 subexpr {1<<2 < 3 < 4} 13 operator < 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1<<2 < 3 > martha": * preceding $*}} @@ -340,7 +344,7 @@ test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} testexprpa testexprparser {1+2 << 3} -1 } {- {} 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1-foo << 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1-foo << 3": * preceding $*}} @@ -360,7 +364,7 @@ test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} testexpr testexprparser {1+2 << 3 << 4} -1 } {- {} 0 subexpr {1+2 << 3 << 4} 13 operator << 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1+2 << 3 >> martha": * preceding $*}} @@ -369,7 +373,7 @@ test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexp testexprparser {1*2 + 3} -1 } {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1/foo + 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1/foo + 3": * preceding $*}} @@ -389,7 +393,7 @@ test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} testexprpa testexprparser {1*2 + 3 + 4} -1 } {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1*2 + 3 - martha": * preceding $*}} @@ -398,7 +402,7 @@ test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexp testexprparser {1*2 + 3} -1 } {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1/foo + 3} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1/foo + 3": * preceding $*}} @@ -418,7 +422,7 @@ test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} testexprpa testexprparser {1*2 + 3 + 4} -1 } {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "1*2 + 3 - martha": * preceding $*}} @@ -448,7 +452,7 @@ test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} teste testexprparser {-2 / 3 % 4} -1 } {- {} 0 subexpr {-2 / 3 % 4} 11 operator % 0 subexpr {-2 / 3} 7 operator / 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "++2 / 3 * martha": * preceding $*}} @@ -474,10 +478,10 @@ test parseExpr-14.6 {ParseUnaryExpr procedure, simple unary expr after unary op} test parseExpr-14.7 {ParseUnaryExpr procedure, another unary expr after unary op} testexprparser { testexprparser {~!{fred}} -1 } {- {} 0 subexpr ~!{fred} 5 operator ~ 0 subexpr !{fred} 3 operator ! 0 subexpr {{fred}} 1 text fred 0 {}} -test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} testexprparser { +test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} {testexprparser oldExprParser} { list [catch {testexprparser {+-||27} -1} msg] $msg } {1 {syntax error in expression "+-||27": unexpected operator ||}} -test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} testexprparser { +test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} {testexprparser oldExprParser} { list [catch {testexprparser {+-||27} -1} msg] $msg } {1 {syntax error in expression "+-||27": unexpected operator ||}} test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} testexprparser { @@ -499,10 +503,10 @@ test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexpr test parseExpr-15.3 {ParsePrimaryExpr procedure, valid parenthesized subexpr} testexprparser { testexprparser {({abc}? 2*4 : -6)} -1 } {- {} 0 subexpr {{abc}? 2*4 : -6} 13 operator ? 0 subexpr {{abc}} 1 text abc 0 subexpr 2*4 5 operator * 0 subexpr 2 1 text 2 0 subexpr 4 1 text 4 0 subexpr -6 3 operator - 0 subexpr 6 1 text 6 0 {}} -test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} testexprparser { +test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} {testexprparser oldExprParser} { list [catch {testexprparser {(? 123 : 456)} -1} msg] $msg } {1 {syntax error in expression "(? 123 : 456)": unexpected ternary 'then' separator}} -test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} testexprparser { +test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} {testexprparser oldExprParser} { list [catch {testexprparser {({abc}/{def}} -1} msg] $msg } {1 {syntax error in expression "({abc}/{def}": looking for close parenthesis}} test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} testexprparser { @@ -520,13 +524,13 @@ test parseExpr-15.9 {ParsePrimaryExpr procedure, primary is var reference} teste test parseExpr-15.10 {ParsePrimaryExpr procedure, primary is var reference} testexprparser { testexprparser {$a()} -1 } {- {} 0 subexpr {$a()} 3 variable {$a()} 2 text a 0 text {} 0 {}} -test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} testexprparser { +test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} {testexprparser oldExprParser} { list [catch {testexprparser {$a(} -1} msg] $msg } {1 {missing )}} test parseExpr-15.12 {ParsePrimaryExpr procedure, primary is quoted string} testexprparser { testexprparser {"abc $xyz def"} -1 } {- {} 0 subexpr {"abc $xyz def"} 5 word {"abc $xyz def"} 4 text {abc } 0 variable {$xyz} 1 text xyz 0 text { def} 0 {}} -test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} testexprparser { +test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} {testexprparser oldExprParser} { list [catch {testexprparser {"$a(12"} -1} msg] $msg } {1 {missing )}} test parseExpr-15.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} testexprparser { @@ -541,13 +545,13 @@ test parseExpr-15.16 {ParsePrimaryExpr procedure, primary is multiple commands} test parseExpr-15.17 {ParsePrimaryExpr procedure, primary is multiple commands} testexprparser { testexprparser {[one; two; three; four;]} -1 } {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}} -test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} testexprparser { +test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} {testexprparser oldExprParser} { list [catch {testexprparser {[one} -1} msg] $msg } {1 {missing close-bracket}} test parseExpr-15.19 {ParsePrimaryExpr procedure, primary is braced string} testexprparser { testexprparser {{hello world}} -1 } {- {} 0 subexpr {{hello world}} 1 text {hello world} 0 {}} -test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} testexprparser { +test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} {testexprparser oldExprParser} { list [catch {testexprparser "\{abc\\\n" -1} msg] $msg } {1 {missing close-brace}} test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} testexprparser { @@ -561,7 +565,7 @@ test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} \ - -constraints testexprparser -body { + -constraints {testexprparser oldExprParser} -body { list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg } -match glob \ -result {1 {syntax error in expression "foo 27.4 123)": * preceding $*}} @@ -571,10 +575,10 @@ test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexp test parseExpr-15.26 {ParsePrimaryExpr procedure, function call, one arg} testexprparser { testexprparser {foo(27*4)} -1 } {- {} 0 subexpr foo(27*4) 7 operator foo 0 subexpr 27*4 5 operator * 0 subexpr 27 1 text 27 0 subexpr 4 1 text 4 0 {}} -test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} testexprparser { +test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} {testexprparser oldExprParser} { list [catch {testexprparser {foo(*1-2)} -1} msg] $msg } {1 {syntax error in expression "foo(*1-2)": unexpected operator *}} -test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} testexprparser { +test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} {testexprparser oldExprParser} { list [catch {testexprparser {foo(*1-2)} -1} msg] $msg } {1 {syntax error in expression "foo(*1-2)": unexpected operator *}} test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg} testexprparser { @@ -583,22 +587,22 @@ test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg test parseExpr-15.30 {ParsePrimaryExpr procedure, bad lexeme after comma} {testexprparser wideIs32bit} { list [catch {testexprparser {foo(123, 12345678901234567890)} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} testexprparser { +test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} {testexprparser oldExprParser} { list [catch {testexprparser {foo(123 [foo])} -1} msg] $msg } {1 {syntax error in expression "foo(123 [foo])": missing close parenthesis at end of function call}} test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} {testexprparser wideIs32bit} { list [catch {testexprparser {123 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} testexprparser { +test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} {testexprparser oldExprParser} { list [catch {testexprparser {123+,456} -1} msg] $msg } {1 {syntax error in expression "123+,456": commas can only separate function arguments}} -test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} testexprparser { +test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} {testexprparser oldExprParser} { list [catch {testexprparser {123+=456} -1} msg] $msg } {1 {syntax error in expression "123+=456": single equality character not legal in expressions}} -test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} testexprparser { +test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} {testexprparser oldExprParser} { list [catch {testexprparser {(: 123 : 456)} -1} msg] $msg } {1 {syntax error in expression "(: 123 : 456)": unexpected ternary 'else' separator}} -test parseExpr-15.36 {ParsePrimaryExpr procedure, missing close-bracket} testexprparser { +test parseExpr-15.36 {ParsePrimaryExpr procedure, missing close-bracket} {testexprparser oldExprParser} { # Test for Bug 681841 list [catch {testexprparser {[set a [format bc]} -1} msg] $msg } {1 {missing close-bracket}} @@ -641,7 +645,7 @@ test parseExpr-16.11a {GetLexeme procedure, bad double lexeme too big} {testexpr test parseExpr-16.11b {GetLexeme procedure, bad double lexeme too big} {testexprparser && ieeeFloatingPoint} { list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg } {0 {- {} 0 subexpr 123.e+99999999999999 1 text 123.e+99999999999999 0 {}}} -test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} testexprparser { +test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} {testexprparser oldExprParser} { list [catch {testexprparser {123.4x56} -1} msg] $msg } {1 {syntax error in expression "123.4x56": extra tokens at end of expression}} test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} testexprparser { @@ -704,7 +708,7 @@ test parseExpr-16.31 {GetLexeme procedure, lexeme is ">="} testexprparser { test parseExpr-16.32 {GetLexeme procedure, lexeme is "=="} testexprparser { testexprparser {2==3} -1 } {- {} 0 subexpr 2==3 5 operator == 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} testexprparser { +test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} {testexprparser oldExprParser} { list [catch {testexprparser {2=+3} -1} msg] $msg } {1 {syntax error in expression "2=+3": extra tokens at end of expression}} test parseExpr-16.34 {GetLexeme procedure, lexeme is "!="} testexprparser { @@ -737,7 +741,7 @@ test parseExpr-16.42 {GetLexeme procedure, lexeme is func name} testexprparser { test parseExpr-16.43 {GetLexeme procedure, lexeme is func name} testexprparser { testexprparser {harmonic_ratio(2,3)} -1 } {- {} 0 subexpr harmonic_ratio(2,3) 5 operator harmonic_ratio 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} testexprparser { +test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} {testexprparser oldExprParser} { list [catch {testexprparser {@27} -1} msg] $msg } {1 {syntax error in expression "@27": character not legal in expressions}} @@ -745,11 +749,11 @@ test parseExpr-17.1 {PrependSubExprTokens procedure, expand token array} testexp testexprparser {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} -1 } {- {} 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 13 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 9 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 5 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 {}} -test parseExpr-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} testexprparser { +test parseExpr-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} {testexprparser oldExprParser} { list [catch {testexprparser {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1} msg] $msg } {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": premature end of expression}} -test parseExpr-19.1 {TclParseInteger: [Bug 648441]} { +test parseExpr-19.1 {TclParseInteger: [Bug 648441]} {oldExprParser} { # Should see this as integer "0" followed by incomplete function "x" # Thus, syntax error. # If Bug 648441 is not fixed, "0x" will be seen as floating point 0.0 diff --git a/tests/while.test b/tests/while.test index 0352da4..d317883 100644 --- a/tests/while.test +++ b/tests/while.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: while.test,v 1.9 2004/09/26 16:36:06 msofer Exp $ +# RCS: @(#) $Id: while.test,v 1.10 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 "while" operation. catch {unset i} @@ -26,7 +30,7 @@ test while-1.1 {TclCompileWhileCmd: missing test expression} { catch {while } msg set msg } {wrong # args: should be "while test command"} -test while-1.2 {TclCompileWhileCmd: error in test expression} -body { +test while-1.2 {TclCompileWhileCmd: error in test expression} -constraints {oldExprParser} -body { set i 0 catch {while {$i<} break} msg set errorInfo @@ -301,7 +305,7 @@ test while-4.2 {while (not compiled): missing test expression} { catch {$z } msg set msg } {wrong # args: should be "while test command"} -test while-4.3 {while (not compiled): error in test expression} { +test while-4.3 {while (not compiled): error in test expression} {oldExprParser} { set i 0 set z while catch {$z {$i<} {set x 1}} msg -- cgit v0.12