summaryrefslogtreecommitdiffstats
path: root/tests/compExpr-old.test
diff options
context:
space:
mode:
authordas <das>2006-08-02 20:03:37 (GMT)
committerdas <das>2006-08-02 20:03:37 (GMT)
commit1cb22227799972e31fd2e85ec0bc738dd5e176be (patch)
tree13a07ee3d0d7210cea34074b87295ad955a75a52 /tests/compExpr-old.test
parent9f9399bfc4d9360d78f52967530fd2070531a1d9 (diff)
downloadtcl-1cb22227799972e31fd2e85ec0bc738dd5e176be.zip
tcl-1cb22227799972e31fd2e85ec0bc738dd5e176be.tar.gz
tcl-1cb22227799972e31fd2e85ec0bc738dd5e176be.tar.bz2
* 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.
Diffstat (limited to 'tests/compExpr-old.test')
-rw-r--r--tests/compExpr-old.test90
1 files changed, 47 insertions, 43 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<x} msg
set msg
} -match glob -result {syntax error in expression "2<x": * preceding $*}
@@ -387,17 +391,17 @@ test compExpr-old-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2
test compExpr-old-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253
test compExpr-old-10.3 {CompileShiftExpr: just add expr} {expr -1--2} 1
test compExpr-old-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82
-test compExpr-old-10.5 {CompileShiftExpr: error in add expr} -body {
+test compExpr-old-10.5 {CompileShiftExpr: error in add expr} -constraints {oldExprParser} -body {
catch {expr x+3} msg
set msg
} -match glob -result {syntax error in expression "x+3": * preceding $*}
test compExpr-old-10.6 {CompileShiftExpr: simple shift exprs} {expr 0xff>>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<<x} msg
set msg
} -match glob -result {syntax error in expression "2<<x": * preceding $*}
@@ -412,17 +416,17 @@ test compExpr-old-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8
test compExpr-old-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1
test compExpr-old-11.3 {CompileAddExpr: just multiply expr} {expr -1/2} -1
test compExpr-old-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6
-test compExpr-old-11.5 {CompileAddExpr: error in multiply expr} -body {
+test compExpr-old-11.5 {CompileAddExpr: error in multiply expr} -constraints {oldExprParser} -body {
catch {expr x*3} msg
set msg
} -match glob -result {syntax error in expression "x*3": * preceding $*}
test compExpr-old-11.6 {CompileAddExpr: simple add exprs} {expr 0xff++0x3} 258
test compExpr-old-11.7 {CompileAddExpr: simple add exprs} {expr -0xf2--0x3} -239
-test compExpr-old-11.8 {CompileAddExpr: error compiling add arm} {
+test compExpr-old-11.8 {CompileAddExpr: error compiling add arm} {oldExprParser} {
catch {expr 2***3+6} msg
set msg
} {syntax error in expression "2***3+6": unexpected operator *}
-test compExpr-old-11.9 {CompileAddExpr: error compiling add arm} -body {
+test compExpr-old-11.9 {CompileAddExpr: error compiling add arm} -constraints {oldExprParser} -body {
catch {expr 2-x} msg
set msg
} -match glob -result {syntax error in expression "2-x": * preceding $*}
@@ -446,17 +450,17 @@ test compExpr-old-12.1 {CompileMultiplyExpr: just unary expr} {expr ~4} -5
test compExpr-old-12.2 {CompileMultiplyExpr: just unary expr} {expr --5} 5
test compExpr-old-12.3 {CompileMultiplyExpr: just unary expr} {expr !27} 0
test compExpr-old-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936
-test compExpr-old-12.5 {CompileMultiplyExpr: error in unary expr} -body {
+test compExpr-old-12.5 {CompileMultiplyExpr: error in unary expr} -constraints {oldExprParser} -body {
catch {expr ~x} msg
set msg
} -match glob -result {syntax error in expression "~x": * preceding $*}
test compExpr-old-12.6 {CompileMultiplyExpr: simple multiply exprs} {expr 0xff*0x3} 765
test compExpr-old-12.7 {CompileMultiplyExpr: simple multiply exprs} {expr -0xf2%-0x3} -2
-test compExpr-old-12.8 {CompileMultiplyExpr: error compiling multiply arm} {
+test compExpr-old-12.8 {CompileMultiplyExpr: error compiling multiply arm} {oldExprParser} {
catch {expr 2*3%%6} msg
set msg
} {syntax error in expression "2*3%%6": unexpected operator %}
-test compExpr-old-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body {
+test compExpr-old-12.9 {CompileMultiplyExpr: error compiling multiply arm} -constraints {oldExprParser} -body {
catch {expr 2*x} msg
set msg
} -match glob -result {syntax error in expression "2*x": * preceding $*}
@@ -474,11 +478,11 @@ test compExpr-old-13.4 {CompileUnaryExpr: unary exprs} {expr !2} 0
test compExpr-old-13.5 {CompileUnaryExpr: unary exprs} {expr +--+-62.0} -62.0
test compExpr-old-13.6 {CompileUnaryExpr: unary exprs} {expr !0.0} 1
test compExpr-old-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0
-test compExpr-old-13.8 {CompileUnaryExpr: error compiling unary expr} -body {
+test compExpr-old-13.8 {CompileUnaryExpr: error compiling unary expr} -constraints {oldExprParser} -body {
catch {expr ~x} msg
set msg
} -match glob -result {syntax error in expression "~x": * preceding $*}
-test compExpr-old-13.9 {CompileUnaryExpr: error compiling unary expr} {
+test compExpr-old-13.9 {CompileUnaryExpr: error compiling unary expr} {oldExprParser} {
catch {expr !1.x} msg
set msg
} {syntax error in expression "!1.x": extra tokens at end of expression}
@@ -541,13 +545,13 @@ test compExpr-old-14.15 {CompilePrimaryExpr: var reference primary} {
catch {expr $i.2} msg
set msg
} 123.2
-test compExpr-old-14.16 {CompilePrimaryExpr: error compiling var reference primary} -body {
+test compExpr-old-14.16 {CompilePrimaryExpr: error compiling var reference primary} -constraints {oldExprParser} -body {
catch {expr {$a(foo}} msg
set errorInfo
} -match glob -result {missing )
while *ing
"expr {$a(foo}"}
-test compExpr-old-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {
+test compExpr-old-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {oldExprParser} {
expr $
} $
test compExpr-old-14.18 {CompilePrimaryExpr: quoted string primary} {
@@ -576,7 +580,7 @@ test compExpr-old-14.23 {CompilePrimaryExpr: error in subcommand primary} -body
} -match glob -result {wrong # args: should be "set varName ?newValue?"
while *ing
"set"*}
-test compExpr-old-14.24 {CompilePrimaryExpr: error in subcommand primary} -body {
+test compExpr-old-14.24 {CompilePrimaryExpr: error in subcommand primary} -constraints {oldExprParser} -body {
catch {expr {[set i}} msg
set errorInfo
} -match glob -result {missing close-bracket
@@ -588,7 +592,7 @@ test compExpr-old-14.25 {CompilePrimaryExpr: math function primary} {
test compExpr-old-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
-test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} -body {
+test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} -constraints {oldExprParser} -body {
catch {expr sinh::(2.0)} msg
set errorInfo
} -match glob -result {syntax error in expression "sinh::(2.0)": * function arguments*
@@ -603,7 +607,7 @@ test compExpr-old-14.29 {CompilePrimaryExpr: error in subexpression primary} -bo
} -match glob -result {wrong # args: should be "set varName ?newValue?"
while *ing
"set"*}
-test compExpr-old-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} -body {
+test compExpr-old-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} -constraints {oldExprParser} -body {
catch {expr 2+(3*(4+5)} msg
set errorInfo
} -match glob -result {syntax error in expression "2+(3*(4+5)": looking for close parenthesis
@@ -613,14 +617,14 @@ test compExpr-old-14.31 {CompilePrimaryExpr: just var ref in subexpression prima
set i "5+10"
list "[expr $i] == 15" "[expr ($i)] == 15" "[eval expr ($i)] == 15"
} {{15 == 15} {15 == 15} {15 == 15}}
-test compExpr-old-14.32 {CompilePrimaryExpr: unexpected token} -body {
+test compExpr-old-14.32 {CompilePrimaryExpr: unexpected token} -constraints {oldExprParser} -body {
catch {expr @} msg
set errorInfo
} -match glob -result {syntax error in expression "@": character not legal in expressions
while *ing
"expr @"}
-test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} -body {
+test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} -constraints {oldExprParser} -body {
catch {expr sinh2.0)} msg
set errorInfo
} -match glob -result {syntax error in expression "sinh2.0)": * preceding $*
@@ -650,7 +654,7 @@ test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} -body {
} -match glob -result {too few arguments for math function*
while *ing
"expr pow(1)"}
-test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -body {
+test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -constraints {oldExprParser} -body {
catch {expr sin(1} msg
set errorInfo
} -match glob -result {syntax error in expression "sin(1": missing close parenthesis at end of function call