summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--tests/compExpr-old.test311
-rw-r--r--tests/compExpr.test78
-rw-r--r--tests/compile.test22
-rw-r--r--tests/expr-old.test136
-rw-r--r--tests/expr.test425
-rw-r--r--tests/for.test20
-rw-r--r--tests/if.test48
-rw-r--r--tests/parseExpr.test457
-rw-r--r--tests/while.test22
10 files changed, 686 insertions, 843 deletions
diff --git a/ChangeLog b/ChangeLog
index ff86005..852611e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,16 @@
TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same
additional info in error message.
+ * tests/compExpr-old.test: Update existing tests to not fail
+ * tests/compExpr.test: with the new expr parser.
+ * tests/compile.test:
+ * tests/expr-old.test:
+ * tests/expr.test:
+ * tests/for.test:
+ * tests/if.test:
+ * tests/parseExpr.test:
+ * tests/while.test:
+
2006-08-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
* win/Makefile.in (gdb): Make this target work so that debugging an
diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test
index ef8b1ca..b24397f 100644
--- a/tests/compExpr-old.test
+++ b/tests/compExpr-old.test
@@ -12,17 +12,13 @@
# 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.19 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: compExpr-old.test,v 1.20 2006/08/22 04:03:23 dgp 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 {
@@ -197,34 +193,28 @@ 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} {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} {oldExprParser} {
- catch {expr 7*[llength "a b"]foo} msg
- set msg
-} {syntax error in expression "7*2foo": extra tokens at end of expression}
+test compExpr-old-2.2 {TclCompileExpr: error in expr} -body {
+ expr 2***3
+} -returnCodes error -match glob -result *
+test compExpr-old-2.3 {TclCompileExpr: junk after legal expr} -body {
+ expr 7*[llength "a b"]foo
+} -returnCodes error -match glob -result *
test compExpr-old-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
test compExpr-old-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
-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.2 {CompileCondExpr: error in lor expr} -body {
+ expr x||3
+} -returnCodes error -match glob -result *
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} {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.4 {CompileCondExpr: error compiling true arm} -body {
+ expr 3>2?2***3:66
+} -returnCodes error -match glob -result *
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} {oldExprParser} {
- catch {expr 2>3?44:2***3} msg
- set msg
-} {syntax error in expression "2>3?44:2***3": unexpected operator *}
+test compExpr-old-3.6 {CompileCondExpr: error compiling false arm} -body {
+ expr 2>3?44:2***3
+} -returnCodes error -match glob -result *
test compExpr-old-3.7 {CompileCondExpr: long arms & nested cond exprs} {
hello_world
} {Hello world}
@@ -234,21 +224,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} -constraints {oldExprParser} -body {
- catch {expr x&&3} msg
- set msg
-} -match glob -result {syntax error in expression "x&&3": * preceding $*}
+test compExpr-old-4.2 {CompileLorExpr: error in land expr} -body {
+ expr x&&3
+} -returnCodes error -match glob -result *
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} {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} {oldExprParser} {
- catch {expr 1.3||2***3} msg
- set msg
-} {syntax error in expression "1.3||2***3": unexpected operator *}
+test compExpr-old-4.6 {CompileLorExpr: error compiling lor arm} -body {
+ expr 2***3||4.0
+} -returnCodes error -match glob -result *
+test compExpr-old-4.7 {CompileLorExpr: error compiling lor arm} -body {
+ expr 1.3||2***3
+} -returnCodes error -match glob -result *
test compExpr-old-4.8 {CompileLorExpr: error compiling lor arms} {
list [catch {expr {"a"||"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -259,22 +246,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x|3} msg
- set msg
-} -match glob -result {syntax error in expression "x|3": * preceding $*}
+test compExpr-old-5.2 {CompileLandExpr: error in bitor expr} -body {
+ expr x|3
+} -returnCodes error -match glob -result *
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} {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} {oldExprParser} {
- catch {expr 1.3&&2***3} msg
- set msg
-} {syntax error in expression "1.3&&2***3": unexpected operator *}
+test compExpr-old-5.7 {CompileLandExpr: error compiling land arm} -body {
+ expr 2***3&&4.0
+} -returnCodes error -match glob -result *
+test compExpr-old-5.8 {CompileLandExpr: error compiling land arm} -body {
+ expr 1.3&&2***3
+} -returnCodes error -match glob -result *
test compExpr-old-5.9 {CompileLandExpr: error compiling land arm} {
list [catch {expr {"a"&&"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -285,22 +269,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x|3} msg
- set msg
-} -match glob -result {syntax error in expression "x|3": * preceding $*}
+test compExpr-old-6.2 {CompileBitXorExpr: error in bitand expr} -body {
+ expr x|3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2^x} msg
- set msg
-} -match glob -result {syntax error in expression "2^x": * preceding $*}
+test compExpr-old-6.7 {CompileBitXorExpr: error compiling bitxor arm} -body {
+ expr 2***3|6
+} -returnCodes error -match glob -result *
+test compExpr-old-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body {
+ expr 2^x
+} -returnCodes error -match glob -result *
test compExpr-old-6.9 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {24.0^3}} msg] $msg
} {1 {can't use floating-point value as operand of "^"}}
@@ -312,22 +293,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x==3} msg
- set msg
-} -match glob -result {syntax error in expression "x==3": * preceding $*}
+test compExpr-old-7.5 {CompileBitAndExpr: error in equality expr} -body {
+ expr x==3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2&x} msg
- set msg
-} -match glob -result {syntax error in expression "2&x": * preceding $*}
+test compExpr-old-7.10 {CompileBitAndExpr: error compiling bitand arm} -body {
+ expr 2***3&6
+} -returnCodes error -match glob -result *
+test compExpr-old-7.11 {CompileBitAndExpr: error compiling bitand arm} -body {
+ expr 2&x
+} -returnCodes error -match glob -result *
test compExpr-old-7.12 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {24.0&3}} msg] $msg
} {1 {can't use floating-point value as operand of "&"}}
@@ -339,22 +317,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x>3} msg
- set msg
-} -match glob -result {syntax error in expression "x>3": * preceding $*}
+test compExpr-old-8.5 {CompileEqualityExpr: error in relational expr} -body {
+ expr x>3
+} -returnCodes error -match glob -result *
test compExpr-old-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13} 0
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2!=x} msg
- set msg
-} -match glob -result {syntax error in expression "2!=x": * preceding $*}
+test compExpr-old-8.10 {CompileEqualityExpr: error compiling equality arm} -body {
+ expr 2***3==6
+} -returnCodes error -match glob -result *
+test compExpr-old-8.11 {CompileEqualityExpr: error compiling equality arm} -body {
+ expr 2!=x
+} -returnCodes error -match glob -result *
test compExpr-old-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12
@@ -372,39 +347,33 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x>>3} msg
- set msg
-} -match glob -result {syntax error in expression "x>>3": * preceding $*}
+test compExpr-old-9.6 {CompileRelationalExpr: error in shift expr} -body {
+ expr x>>3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2<x} msg
- set msg
-} -match glob -result {syntax error in expression "2<x": * preceding $*}
+test compExpr-old-9.9 {CompileRelationalExpr: error compiling relational arm} -body {
+ expr 2***3>6
+} -returnCodes error -match glob -result *
+test compExpr-old-9.10 {CompileRelationalExpr: error compiling relational arm} -body {
+ expr 2<x
+} -returnCodes error -match glob -result *
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} -constraints {oldExprParser} -body {
- catch {expr x+3} msg
- set msg
-} -match glob -result {syntax error in expression "x+3": * preceding $*}
+test compExpr-old-10.5 {CompileShiftExpr: error in add expr} -body {
+ expr x+3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2<<x} msg
- set msg
-} -match glob -result {syntax error in expression "2<<x": * preceding $*}
+test compExpr-old-10.8 {CompileShiftExpr: error compiling shift arm} -body {
+ expr 2***3>>6
+} -returnCodes error -match glob -result *
+test compExpr-old-10.9 {CompileShiftExpr: error compiling shift arm} -body {
+ expr 2<<x
+} -returnCodes error -match glob -result *
test compExpr-old-10.10 {CompileShiftExpr: runtime error} {
list [catch {expr {24.0>>43}} msg] $msg
} {1 {can't use floating-point value as operand of ">>"}}
@@ -416,20 +385,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} -constraints {oldExprParser} -body {
- catch {expr x*3} msg
- set msg
-} -match glob -result {syntax error in expression "x*3": * preceding $*}
+test compExpr-old-11.5 {CompileAddExpr: error in multiply expr} -body {
+ expr x*3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2-x} msg
- set msg
-} -match glob -result {syntax error in expression "2-x": * preceding $*}
+test compExpr-old-11.8 {CompileAddExpr: error compiling add arm} -body {
+ expr 2***3+6
+} -returnCodes error -match glob -result *
+test compExpr-old-11.9 {CompileAddExpr: error compiling add arm} -body {
+ expr 2-x
+} -returnCodes error -match glob -result *
test compExpr-old-11.10 {CompileAddExpr: runtime error} {
list [catch {expr {24.0+"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
@@ -450,20 +416,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} -constraints {oldExprParser} -body {
- catch {expr ~x} msg
- set msg
-} -match glob -result {syntax error in expression "~x": * preceding $*}
+test compExpr-old-12.5 {CompileMultiplyExpr: error in unary expr} -body {
+ expr ~x
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2*x} msg
- set msg
-} -match glob -result {syntax error in expression "2*x": * preceding $*}
+test compExpr-old-12.8 {CompileMultiplyExpr: error compiling multiply arm} -body {
+ expr 2*3%%6
+} -returnCodes error -match glob -result *
+test compExpr-old-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body {
+ expr 2*x
+} -returnCodes error -match glob -result *
test compExpr-old-12.10 {CompileMultiplyExpr: runtime error} {
list [catch {expr {24.0*"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "*"}}
@@ -478,14 +441,13 @@ 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} -constraints {oldExprParser} -body {
- catch {expr ~x} msg
+test compExpr-old-13.8 {CompileUnaryExpr: error compiling unary expr} -body {
+ expr ~x
+} -returnCodes error -match glob -result *
+test compExpr-old-13.9 {CompileUnaryExpr: error compiling unary expr} -body {
+ expr !1.x
set msg
-} -match glob -result {syntax error in expression "~x": * preceding $*}
-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}
+} -returnCodes error -match glob -result *
test compExpr-old-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "~"}}
@@ -545,15 +507,12 @@ 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} -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} {oldExprParser} {
+test compExpr-old-14.16 {CompilePrimaryExpr: error compiling var reference primary} -body {
+ expr {$a(foo}
+} -returnCodes error -match glob -result *
+test compExpr-old-14.17 {CompilePrimaryExpr: string primary that looks like var ref} -body {
expr $
-} $
+} -returnCodes error -match glob -result *
test compExpr-old-14.18 {CompilePrimaryExpr: quoted string primary} {
expr "21"
} 21
@@ -580,24 +539,18 @@ 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} -constraints {oldExprParser} -body {
- catch {expr {[set i}} msg
- set errorInfo
-} -match glob -result {missing close-bracket
- while *ing
-"expr {\[set i}"}
+test compExpr-old-14.24 {CompilePrimaryExpr: error in subcommand primary} -body {
+ expr {[set i}
+} -returnCodes error -match glob -result *
test compExpr-old-14.25 {CompilePrimaryExpr: math function primary} {
format %.6g [expr exp(1.0)]
} 2.71828
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} -constraints {oldExprParser} -body {
- catch {expr sinh::(2.0)} msg
- set errorInfo
-} -match glob -result {syntax error in expression "sinh::(2.0)": * function arguments*
- while *ing
-"expr sinh::(2.0)"}
+test compExpr-old-14.27 {CompilePrimaryExpr: error in math function primary} -body {
+ expr sinh::(2.0)
+} -returnCodes error -match glob -result *
test compExpr-old-14.28 {CompilePrimaryExpr: subexpression primary} {
expr 2+(3*4)
} 14
@@ -607,29 +560,20 @@ 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} -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
- while *ing
-"expr 2+(3*(4+5)"}
+test compExpr-old-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} -body {
+ expr 2+(3*(4+5)
+} -returnCodes error -match glob -result *
test compExpr-old-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {
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} -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-14.32 {CompilePrimaryExpr: unexpected token} -body {
+ expr @
+} -returnCodes error -match glob -result *
-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 $*
- while *ing
-"expr sinh2.0)"}
+test compExpr-old-15.1 {CompileMathFuncCall: missing parenthesis} -body {
+ expr sinh2.0)
+} -returnCodes error -match glob -result *
test compExpr-old-15.2 {CompileMathFuncCall: unknown math function} -body {
catch {expr whazzathuh(1)} msg
set errorInfo
@@ -654,12 +598,9 @@ 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 ')'} -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
- while *ing
-"expr sin(1"}
+test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -body {
+ expr sin(1
+} -returnCodes error -match glob -result *
test compExpr-old-15.7 {CompileMathFuncCall: call registered math function} testmathfunctions {
expr 2*T1()
} 246
diff --git a/tests/compExpr.test b/tests/compExpr.test
index f2c7ffc..991033f 100644
--- a/tests/compExpr.test
+++ b/tests/compExpr.test
@@ -8,17 +8,13 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: compExpr.test,v 1.12 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: compExpr.test,v 1.13 2006/08/22 04:03:23 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
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 {
@@ -30,9 +26,9 @@ catch {unset a}
test compExpr-1.1 {TclCompileExpr procedure, successful expr parse and compile} {
expr 1+2
} 3
-test compExpr-1.2 {TclCompileExpr procedure, error parsing expr} {oldExprParser} {
- list [catch {expr 1+2+} msg] $msg
-} {1 {syntax error in expression "1+2+": premature end of expression}}
+test compExpr-1.2 {TclCompileExpr procedure, error parsing expr} -body {
+ expr 1+2+
+} -returnCodes error -match glob -result *
test compExpr-1.3 {TclCompileExpr procedure, error compiling expr} -body {
list [catch {expr "foo(123)"} msg] $msg
} -match glob -result {1 {* "*foo"}}
@@ -47,9 +43,9 @@ test compExpr-2.1 {CompileSubExpr procedure, TCL_TOKEN_WORD parse token} {
set a 27
expr {"foo$a" < "bar"}
} 0
-test compExpr-2.2 {CompileSubExpr procedure, error compiling TCL_TOKEN_WORD parse token} {oldExprParser} {
- list [catch {expr {"00[expr 1+]" + 17}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
+test compExpr-2.2 {CompileSubExpr procedure, error compiling TCL_TOKEN_WORD parse token} -body {
+ expr {"00[expr 1+]" + 17}
+} -returnCodes error -match glob -result *
test compExpr-2.3 {CompileSubExpr procedure, TCL_TOKEN_TEXT parse token} {
expr {{12345}}
} 12345
@@ -66,9 +62,9 @@ test compExpr-2.6 {CompileSubExpr procedure, TCL_TOKEN_COMMAND parse token} {
test compExpr-2.7 {CompileSubExpr procedure, TCL_TOKEN_COMMAND parse token} {
expr {[]}
} {}
-test compExpr-2.8 {CompileSubExpr procedure, error in TCL_TOKEN_COMMAND parse token} {oldExprParser} {
- list [catch {expr {[foo "bar"xxx] + 17}} msg] $msg
-} {1 {extra characters after close-quote}}
+test compExpr-2.8 {CompileSubExpr procedure, error in TCL_TOKEN_COMMAND parse token} -body {
+ expr {[foo "bar"xxx] + 17}
+} -returnCodes error -match glob -result *
test compExpr-2.9 {CompileSubExpr procedure, TCL_TOKEN_VARIABLE parse token} {
catch {unset a}
set a 123
@@ -158,18 +154,18 @@ test compExpr-2.33 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, normal o
test compExpr-2.34 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} {
expr {+2}
} 2
-test compExpr-2.35 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} {oldExprParser} {
- list [catch {expr {+[expr 1+]}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
+test compExpr-2.35 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} -body {
+ expr {+[expr 1+]}
+} -returnCodes error -match glob -result *
test compExpr-2.36 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} {
expr {4+2}
} 6
-test compExpr-2.37 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} {oldExprParser} {
- list [catch {expr {[expr 1+]+5}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
-test compExpr-2.38 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} {oldExprParser} {
- list [catch {expr {5+[expr 1+]}} msg] $msg
-} {1 {syntax error in expression "1+": premature end of expression}}
+test compExpr-2.37 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} -body {
+ expr {[expr 1+]+5}
+} -returnCodes error -match glob -result *
+test compExpr-2.38 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} -body {
+ expr {5+[expr 1+]}
+} -returnCodes error -match glob -result *
test compExpr-2.39 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} {
expr {-2}
} -2
@@ -212,9 +208,9 @@ test compExpr-3.2 {CompileLandOrLorExpr procedure, nonnumeric 1st operand} {
set a no
expr {$a&&1}
} 0
-test compExpr-3.3 {CompileSubExpr procedure, error in 1st operand} {oldExprParser} {
- list [catch {expr {[expr *2]||0}} msg] $msg
-} {1 {syntax error in expression "*2": unexpected operator *}}
+test compExpr-3.3 {CompileSubExpr procedure, error in 1st operand} -body {
+ expr {[expr *2]||0}
+} -returnCodes error -match glob -result *
test compExpr-3.4 {CompileLandOrLorExpr procedure, result is 1 or 0} {
catch {unset a}
catch {unset b}
@@ -242,9 +238,9 @@ test compExpr-3.8 {CompileLandOrLorExpr procedure, nonnumeric 2nd operand} {
set a no
expr {1&&$a}
} 0
-test compExpr-3.9 {CompileLandOrLorExpr procedure, error in 2nd operand} {oldExprParser} {
- list [catch {expr {0||[expr %2]}} msg] $msg
-} {1 {syntax error in expression "%2": unexpected operator %}}
+test compExpr-3.9 {CompileLandOrLorExpr procedure, error in 2nd operand} -body {
+ expr {0||[expr %2]}
+} -returnCodes error -match glob -result *
test compExpr-3.10 {CompileLandOrLorExpr procedure, long lor/land arm} {
set a "abcdefghijkl"
set i 7
@@ -261,9 +257,9 @@ test compExpr-4.2 {CompileCondExpr procedure, complex test, convert to numeric}
set a no
expr {[set a]? 27 : -54}
} -54
-test compExpr-4.3 {CompileCondExpr procedure, error in test} {oldExprParser} {
- list [catch {expr {[expr *2]? +1 : -1}} msg] $msg
-} {1 {syntax error in expression "*2": unexpected operator *}}
+test compExpr-4.3 {CompileCondExpr procedure, error in test} -body {
+ expr {[expr *2]? +1 : -1}
+} -returnCodes error -match glob -result *
test compExpr-4.4 {CompileCondExpr procedure, simple "true" clause} {
catch {unset a}
set a no
@@ -274,9 +270,9 @@ test compExpr-4.5 {CompileCondExpr procedure, convert "true" clause to numeric}
set a no
expr {1? $a : -54}
} no
-test compExpr-4.6 {CompileCondExpr procedure, error in "true" clause} {oldExprParser} {
- list [catch {expr {1? [expr *2] : -127}} msg] $msg
-} {1 {syntax error in expression "*2": unexpected operator *}}
+test compExpr-4.6 {CompileCondExpr procedure, error in "true" clause} -body {
+ expr {1? [expr *2] : -127}
+} -returnCodes error -match glob -result *
test compExpr-4.7 {CompileCondExpr procedure, simple "false" clause} {
catch {unset a}
set a no
@@ -309,9 +305,9 @@ test compExpr-5.5 {CompileMathFuncCall procedure, too few arguments} -body {
test compExpr-5.6 {CompileMathFuncCall procedure, complex argument} {
format %.6g [expr pow(2.1, 27.5-(24.4*(5%2)))]
} 9.97424
-test compExpr-5.7 {CompileMathFuncCall procedure, error in argument} {oldExprParser} {
- list [catch {expr {sinh(2.*)}} msg] $msg
-} {1 {syntax error in expression "sinh(2.*)": unexpected close parenthesis}}
+test compExpr-5.7 {CompileMathFuncCall procedure, error in argument} -body {
+ expr {sinh(2.*)}
+} -returnCodes error -match glob -result *
test compExpr-5.8 {CompileMathFuncCall procedure, too many arguments} -body {
list [catch {expr {sinh(2.0, 3.0)}} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
@@ -319,9 +315,9 @@ test compExpr-5.9 {CompileMathFuncCall procedure, too many arguments} -body {
list [catch {expr {0 <= rand(5.2)}} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
-test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} {oldExprParser} {
- list [catch {expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3} msg] $msg
-} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": extra tokens at end of expression}}
+test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} -body {
+ expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3
+} -returnCodes error -match glob -result *
# cleanup
catch {unset a}
diff --git a/tests/compile.test b/tests/compile.test
index 05602ac..b499b10 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -11,15 +11,11 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: compile.test,v 1.42 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: compile.test,v 1.43 2006/08/22 04:03:23 dgp Exp $
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]}]
-
testConstraint exec [llength [info commands exec]]
testConstraint memory [llength [info commands memory]]
testConstraint testevalex [llength [info commands testevalex]]
@@ -261,14 +257,14 @@ test compile-11.6 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; incr}
list [catch {p} msg] $msg
} {1 {wrong # args: should be "incr varName ?increment?"}}
-test compile-11.7 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -constraints {oldExprParser} -body {
+test compile-11.7 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
proc p {} { set r [list foobar] ; expr !a }
- list [catch {p} msg] $msg
-} -match glob -result {1 {syntax error in expression "!a": * preceding $*}}
-test compile-11.8 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -constraints {oldExprParser} -body {
+ p
+} -returnCodes error -match glob -result *
+test compile-11.8 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body {
proc p {} { set r [list foobar] ; expr {!a} }
- list [catch {p} msg] $msg
-} -match glob -result {1 {syntax error in expression "!a": * preceding $*}}
+ p
+} -returnCodes error -match glob -result *
test compile-11.9 {Tcl_Append*: ensure Tcl_ResetResult is used properly} {
proc p {} { set r [list foobar] ; llength "\{" }
list [catch {p} msg] $msg
@@ -317,14 +313,14 @@ test compile-12.2 {testing error on literal deletion} -constraints {memory exec}
catch {removeFile $sourceFile}
} -result 0
# Test to catch buffer overrun in TclCompileTokens from buf 530320
-test compile-12.3 {check for a buffer overrun} -constraints {oldExprParser} -body {
+test compile-12.3 {check for a buffer overrun} -body {
proc crash {} {
puts $array([expr {a+2}])
}
crash
} -returnCodes error -cleanup {
rename crash {}
-} -match glob -result {syntax error in expression "a+2": * preceding $*}
+} -match glob -result *
test compile-12.4 {TclCleanupLiteralTable segfault} -body {
# Tcl Bug 1001997
# Here, we're trying to test a case that causes a crash in
diff --git a/tests/expr-old.test b/tests/expr-old.test
index be7d3c2..e842f22 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -13,17 +13,13 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: expr-old.test,v 1.36 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: expr-old.test,v 1.37 2006/08/22 04:03:23 dgp 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 testexprlong [llength [info commands testexprlong]]
testConstraint testexprdouble [llength [info commands testexprdouble]]
testConstraint testexprstring [llength [info commands testexprstring]]
@@ -499,12 +495,12 @@ test expr-old-25.20 {type conversions} {expr 10.0} 10.0
test expr-old-26.1 {error conditions} {
list [catch {expr 2+"a"} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
-test expr-old-26.2 {error conditions} {oldExprParser} {
- list [catch {expr 2+4*} msg] $msg
-} {1 {syntax error in expression "2+4*": premature end of expression}}
-test expr-old-26.3 {error conditions} {oldExprParser} {
- list [catch {expr 2+4*(} msg] $msg
-} {1 {syntax error in expression "2+4*(": premature end of expression}}
+test expr-old-26.2 {error conditions} -body {
+ expr 2+4*
+} -returnCodes error -match glob -result *
+test expr-old-26.3 {error conditions} -body {
+ expr 2+4*(
+} -returnCodes error -match glob -result *
catch {unset _non_existent_}
test expr-old-26.4 {error conditions} {
list [catch {expr 2+$_non_existent_} msg] $msg
@@ -516,9 +512,9 @@ test expr-old-26.5 {error conditions} {
test expr-old-26.6 {error conditions} {
list [catch {expr {2+[set a]}} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
-test expr-old-26.7 {error conditions} {oldExprParser} {
- list [catch {expr {2+(4}} msg] $msg
-} {1 {syntax error in expression "2+(4": looking for close parenthesis}}
+test expr-old-26.7 {error conditions} -body {
+ expr {2+(4}
+} -returnCodes error -match glob -result *
test expr-old-26.8 {error conditions} {
list [catch {expr 2/0} msg] $msg $errorCode
} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}}
@@ -531,33 +527,33 @@ test expr-old-26.10a {error conditions} !ieeeFloatingPoint {
test expr-old-26.10b {error conditions} ieeeFloatingPoint {
list [catch {expr 2.0/0.0} msg] $msg
} {0 Inf}
-test expr-old-26.11 {error conditions} {oldExprParser} {
- list [catch {expr 2#} msg] $msg
-} {1 {syntax error in expression "2#": extra tokens at end of expression}}
-test expr-old-26.12 {error conditions} -constraints {oldExprParser} -body {
- list [catch {expr a.b} msg] $msg
-} -match glob -result {1 {syntax error in expression "a.b": * preceding $*}}
+test expr-old-26.11 {error conditions} -body {
+ expr 2#
+} -returnCodes error -match glob -result *
+test expr-old-26.12 {error conditions} -body {
+ expr a.b
+} -returnCodes error -match glob -result *
test expr-old-26.13 {error conditions} {
list [catch {expr {"a"/"b"}} msg] $msg
} {1 {can't use non-numeric string as operand of "/"}}
-test expr-old-26.14 {error conditions} {oldExprParser} {
- list [catch {expr 2:3} msg] $msg
-} {1 {syntax error in expression "2:3": extra tokens at end of expression}}
-test expr-old-26.15 {error conditions} -constraints {oldExprParser} -body {
- list [catch {expr a@b} msg] $msg
-} -match glob -result {1 {syntax error in expression "a@b": * preceding $*}}
+test expr-old-26.14 {error conditions} -body {
+ expr 2:3
+} -returnCodes error -match glob -result *
+test expr-old-26.15 {error conditions} -body {
+ expr a@b
+} -returnCodes error -match glob -result *
test expr-old-26.16 {error conditions} {
list [catch {expr a[b} msg] $msg
} {1 {missing close-bracket}}
-test expr-old-26.17 {error conditions} -constraints {oldExprParser} -body {
- list [catch {expr a`b} msg] $msg
-} -match glob -result {1 {syntax error in expression "a`b": * preceding $*}}
-test expr-old-26.18 {error conditions} {oldExprParser} {
- list [catch {expr \"a\"\{b} msg] $msg
-} {1 syntax\ error\ in\ expression\ \"\"a\"\{b\":\ extra\ tokens\ at\ end\ of\ expression}
-test expr-old-26.19 {error conditions} -constraints {oldExprParser} -body {
- list [catch {expr a} msg] $msg
-} -match glob -result {1 {syntax error in expression "a": * preceding $*}}
+test expr-old-26.17 {error conditions} -body {
+ expr a`b
+} -returnCodes error -match glob -result *
+test expr-old-26.18 {error conditions} -body {
+ expr \"a\"\{b
+} -returnCodes error -match glob -result *
+test expr-old-26.19 {error conditions} -body {
+ expr a
+} -returnCodes error -match glob -result *
test expr-old-26.20 {error conditions} {
list [catch expr msg] $msg
} {1 {wrong # args: should be "expr arg ?arg ...?"}}
@@ -605,12 +601,12 @@ test expr-old-27.10 {cancelled evaluation} {
set x -1.0
list [catch {expr {($x > 0) ? round(log($x)) : 0}} msg] $msg
} {0 0}
-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} -constraints {oldExprParser} -body {
- list [catch {expr {0 ? 1 : foo}} msg] $msg
-} -match glob -result {1 {syntax error in expression "0 ? 1 : foo": * preceding $*}}
+test expr-old-27.11 {cancelled evaluation} -body {
+ expr {0 && foo}
+} -returnCodes error -match glob -result *
+test expr-old-27.12 {cancelled evaluation} -body {
+ expr {0 ? 1 : foo}
+} -returnCodes error -match glob -result *
# Tcl_ExprBool as used in "if" statements
@@ -685,9 +681,9 @@ 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} {oldExprParser} {
- list [catch {expr "\{abc"} msg] $msg
-} {1 {missing close-brace}}
+test expr-old-29.5 {braces} -body {
+ expr "\{abc"
+} -returnCodes error -match glob -result *
# Very long values
@@ -708,15 +704,15 @@ 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} {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} {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} {oldExprParser} {
- list [catch {expr 2 + 3 )} msg] $msg
-} {1 {syntax error in expression "2 + 3 )": extra tokens at end of expression}}
+test expr-old-31.2 {multiple arguments to expr command} -body {
+ expr 2 + (3 + 4
+} -returnCodes error -match glob -result *
+test expr-old-31.3 {multiple arguments to expr command} -body {
+ expr 2 + 3 +
+} -returnCodes error -match glob -result *
+test expr-old-31.4 {multiple arguments to expr command} -body {
+ expr 2 + 3 )
+} -returnCodes error -match glob -result *
# Math functions
@@ -906,21 +902,21 @@ 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} -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.2 {errors in math functions} -body {
+ expr func|(1.0)
+} -returnCodes error -match glob -result *
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} {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} {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} {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.4 {errors in math functions} -body {
+ expr hypot(1.0 2.0)
+} -returnCodes error -match glob -result *
+test expr-old-34.5 {errors in math functions} -body {
+ expr hypot(1.0, 2.0
+} -returnCodes error -match glob -result *
+test expr-old-34.6 {errors in math functions} -body {
+ expr hypot(1.0 ,
+} -returnCodes error -match glob -result *
test expr-old-34.7 {errors in math functions} -body {
list [catch {expr hypot(1.0)} msg] $msg
} -match glob -result {1 {too few arguments for math function*}}
@@ -993,9 +989,9 @@ 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} -constraints {oldExprParser} -body {
+test expr-old-36.10 {ExprLooksLikeInt procedure} -body {
expr 78e
-} -returnCodes error -match glob -result {syntax error in expression "78e"*}
+} -returnCodes error -match glob -result *
# test for [Bug #542588]
test expr-old-36.11 {ExprLooksLikeInt procedure} {
@@ -1122,14 +1118,14 @@ 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 oldExprParser} {
+ {ieeeFloatingPoint testexprdouble} {
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 oldExprParser} {
+test expr-old-38.1 {Verify Tcl_ExprString's basic operation} -constraints {testexprstring} -body {
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}}
+} -match glob -result {5 10.2 1 *}
test expr-old-38.2 {Tcl_ExprString} testexprstring {
# This one is "magical"
testexprstring {}
diff --git a/tests/expr.test b/tests/expr.test
index ef84607..93efbde 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -10,17 +10,13 @@
# 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.57 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: expr.test,v 1.58 2006/08/22 04:03:24 dgp 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"})
}]
@@ -207,33 +203,28 @@ 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} {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} {oldExprParser} {
- catch {expr 7*[llength "a b"]foo} msg
- set msg
-} {syntax error in expression "7*2foo": extra tokens at end of expression}
+test expr-2.2 {TclCompileExpr: error in expr} -body {
+ expr 2***3
+} -returnCodes error -match glob -result *
+test expr-2.3 {TclCompileExpr: junk after legal expr} -body {
+ expr 7*[llength "a b"]foo
+} -returnCodes error -match glob -result *
test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
-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.2 {CompileCondExpr: error in lor expr} -body {
+ expr x||3
+} -returnCodes error -match glob -result *
test expr-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44
-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.4 {CompileCondExpr: error compiling true arm} -body {
+ expr 3>2?2***3:66
+} -returnCodes error -match glob -result *
test expr-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66
-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 *}
+test expr-3.6 {CompileCondExpr: error compiling false arm} -body {
+ expr 2>3?44:2***3
+} -returnCodes error -match glob -result *
test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} {
hello_world
} {Hello world}
@@ -243,21 +234,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} -constraints {oldExprParser} -body {
- catch {expr x&&3} msg
- set msg
-} -match glob -result {syntax error in expression "x&&3": *preceding $*}
+test expr-4.2 {CompileLorExpr: error in land expr} -body {
+ expr x&&3
+} -returnCodes error -match glob -result *
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} {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} {oldExprParser} {
- catch {expr 1.3||2***3} msg
- set msg
-} {syntax error in expression "1.3||2***3": unexpected operator *}
+test expr-4.6 {CompileLorExpr: error compiling lor arm} -body {
+ expr 2***3||4.0
+} -returnCodes error -match glob -result *
+test expr-4.7 {CompileLorExpr: error compiling lor arm} -body {
+ expr 1.3||2***3
+} -returnCodes error -match glob -result *
test expr-4.8 {CompileLorExpr: error compiling lor arms} {
list [catch {expr {"a"||"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -277,22 +265,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x|3} msg
- set msg
-} -match glob -result {syntax error in expression "x|3": * preceding $*}
+test expr-5.2 {CompileLandExpr: error in bitor expr} -body {
+ expr x|3
+} -returnCodes error -match glob -result *
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} {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} {oldExprParser} {
- catch {expr 1.3&&2***3} msg
- set msg
-} {syntax error in expression "1.3&&2***3": unexpected operator *}
+test expr-5.7 {CompileLandExpr: error compiling land arm} -body {
+ expr 2***3&&4.0
+} -returnCodes error -match glob -result *
+test expr-5.8 {CompileLandExpr: error compiling land arm} -body {
+ expr 1.3&&2***3
+} -returnCodes error -match glob -result *
test expr-5.9 {CompileLandExpr: error compiling land arm} {
list [catch {expr {"a"&&"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -303,22 +288,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x|3} msg
- set msg
-} -match glob -result {syntax error in expression "x|3": * preceding $*}
+test expr-6.2 {CompileBitXorExpr: error in bitand expr} -body {
+ expr x|3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2^x} msg
- set msg
-} -match glob -result {syntax error in expression "2^x": * preceding $**}
+test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} -body {
+ expr 2***3|6
+} -returnCodes error -match glob -result *
+test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body {
+ expr 2^x
+} -returnCodes error -match glob -result *
test expr-6.9 {CompileBitXorExpr: runtime error in bitxor arm} {
list [catch {expr {24.0^3}} msg] $msg
} {1 {can't use floating-point value as operand of "^"}}
@@ -330,22 +312,19 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x==3} msg
- set msg
-} -match glob -result {syntax error in expression "x==3": * preceding $*}
+test expr-7.5 {CompileBitAndExpr: error in equality expr} -body {
+ expr x==3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2&x} msg
- set msg
-} -match glob -result {syntax error in expression "2&x": * preceding $*}
+test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} -body {
+ expr 2***3&6
+} -returnCodes error -match glob -result *
+test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} -body {
+ expr 2&x
+} -returnCodes error -match glob -result *
test expr-7.12 {CompileBitAndExpr: runtime error in bitand arm} {
list [catch {expr {24.0&3}} msg] $msg
} {1 {can't use floating-point value as operand of "&"}}
@@ -354,31 +333,27 @@ 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} -constraints {oldExprParser} -body {
- catch {expr xne3} msg
- set msg
-} -match glob -result {syntax error in expression "xne3": * preceding $*}
+test expr-7.20 {CompileBitAndExpr: error in equality expr} -body {
+ expr xne3
+} -returnCodes error -match glob -result *
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} -constraints {oldExprParser} -body {
- catch {expr x>3} msg
- set msg
-} -match glob -result {syntax error in expression "x>3": * preceding $*}
+test expr-8.5 {CompileEqualityExpr: error in relational expr} -body {
+ expr x>3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2!=x} msg
- set msg
-} -match glob -result {syntax error in expression "2!=x": * preceding $*}
+test expr-8.10 {CompileEqualityExpr: error compiling equality arm} -body {
+ expr 2***3==6
+} -returnCodes error -match glob -result *
+test expr-8.11 {CompileEqualityExpr: error compiling equality arm} -body {
+ expr 2!=x
+} -returnCodes error -match glob -result *
test expr-8.12 {CompileBitAndExpr: equality expr} {expr {"a"eq"a"}} 1
test expr-8.13 {CompileBitAndExpr: equality expr} {expr {"\374" eq "ü"}} 1
test expr-8.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0
@@ -387,23 +362,19 @@ 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} -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} -constraints {oldExprParser} -body {
+test expr-8.20 {CompileBitAndExpr: error in equality expr} -body {
+ expr x ne3
+} -returnCodes error -match glob -result *
+test expr-8.21 {CompileBitAndExpr: error in equality expr} -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} {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} {oldExprParser} {
- catch {expr {false nefalse}} msg
- set msg
-} {syntax error in expression "false nefalse": extra tokens at end of expression}
+ expr a eq b
+} -returnCodes error -match glob -result *
+test expr-8.22 {CompileBitAndExpr: error in equality expr} -body {
+ expr {false eqfalse}
+} -returnCodes error -match glob -result *
+test expr-8.23 {CompileBitAndExpr: error in equality expr} -body {
+ expr {false nefalse}
+} -returnCodes error -match glob -result *
test expr-8.24 {CompileEqualityExpr: simple equality exprs} {
set x 12398712938788234
expr {$x == 100}
@@ -429,21 +400,21 @@ 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} {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} {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} {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} {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} {oldExprParser} {
- list [catch {expr {1ea}} err] $err
-} {1 {syntax error in expression "1ea": extra tokens at end of expression}}
+test expr-8.31 {expr edge cases} -body {
+ expr {1e}
+} -returnCodes error -match glob -result *
+test expr-8.32 {expr edge cases} -body {
+ expr {1E}
+} -returnCodes error -match glob -result *
+test expr-8.33 {expr edge cases} -body {
+ expr {1e+}
+} -returnCodes error -match glob -result *
+test expr-8.34 {expr edge cases} -body {
+ expr {1E+}
+} -returnCodes error -match glob -result *
+test expr-8.35 {expr edge cases} -body {
+ expr {1ea}
+} -returnCodes error -match glob -result *
test expr-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12
test expr-9.2 {CompileRelationalExpr: just shift expr} {expr 0xff>>2} 63
@@ -455,39 +426,33 @@ 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} -constraints {oldExprParser} -body {
- catch {expr x>>3} msg
- set msg
-} -match glob -result {syntax error in expression "x>>3": * preceding $*}
+test expr-9.6 {CompileRelationalExpr: error in shift expr} -body {
+ expr x>>3
+} -returnCodes error -match glob -result *
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} {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} -constraints {oldExprParser} -body {
- catch {expr 2<x} msg
- set msg
-} -match glob -result {syntax error in expression "2<x": * preceding $*}
+test expr-9.9 {CompileRelationalExpr: error compiling relational arm} -body {
+ expr 2***3>6
+} -returnCodes error -match glob -result *
+test expr-9.10 {CompileRelationalExpr: error compiling relational arm} -body {
+ expr 2<x
+} -returnCodes error -match glob -result *
test expr-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2
test expr-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253
test expr-10.3 {CompileShiftExpr: just add expr} {expr -1--2} 1
test expr-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82
-test expr-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 expr-10.5 {CompileShiftExpr: error in add expr} -body {
+ expr x+3
+} -returnCodes error -match glob -result *
test expr-10.6 {CompileShiftExpr: simple shift exprs} {expr 0xff>>0x3} 31
test expr-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936
-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} -constraints {oldExprParser} -body {
- catch {expr 2<<x} msg
- set msg
-} -match glob -result {syntax error in expression "2<<x": * preceding $*}
+test expr-10.8 {CompileShiftExpr: error compiling shift arm} -body {
+ expr 2***3>>6
+} -returnCodes error -match glob -result *
+test expr-10.9 {CompileShiftExpr: error compiling shift arm} -body {
+ expr 2<<x
+} -returnCodes error -match glob -result *
test expr-10.10 {CompileShiftExpr: runtime error} {
list [catch {expr {24.0>>43}} msg] $msg
} {1 {can't use floating-point value as operand of ">>"}}
@@ -499,20 +464,17 @@ test expr-11.1 {CompileAddExpr: just multiply expr} {expr 4*-2} -8
test expr-11.2 {CompileAddExpr: just multiply expr} {expr 0xff%2} 1
test expr-11.3 {CompileAddExpr: just multiply expr} {expr -1/2} -1
test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6
-test expr-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 expr-11.5 {CompileAddExpr: error in multiply expr} -body {
+ expr x*3
+} -returnCodes error -match glob -result *
test expr-11.6 {CompileAddExpr: simple add exprs} {expr 0xff++0x3} 258
test expr-11.7 {CompileAddExpr: simple add exprs} {expr -0xf2--0x3} -239
-test expr-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 expr-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 $*}
+test expr-11.8 {CompileAddExpr: error compiling add arm} -body {
+ expr 2***3+6
+} -returnCodes error -match glob -result *
+test expr-11.9 {CompileAddExpr: error compiling add arm} -body {
+ expr 2-x
+} -returnCodes error -match glob -result *
test expr-11.10 {CompileAddExpr: runtime error} {
list [catch {expr {24.0+"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
@@ -533,20 +495,17 @@ test expr-12.1 {CompileMultiplyExpr: just unary expr} {expr ~4} -5
test expr-12.2 {CompileMultiplyExpr: just unary expr} {expr --5} 5
test expr-12.3 {CompileMultiplyExpr: just unary expr} {expr !27} 0
test expr-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936
-test expr-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 expr-12.5 {CompileMultiplyExpr: error in unary expr} -body {
+ expr ~x
+} -returnCodes error -match glob -result *
test expr-12.6 {CompileMultiplyExpr: simple multiply exprs} {expr 0xff*0x3} 765
test expr-12.7 {CompileMultiplyExpr: simple multiply exprs} {expr -0xf2%-0x3} -2
-test expr-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 expr-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 $*}
+test expr-12.8 {CompileMultiplyExpr: error compiling multiply arm} -body {
+ expr 2*3%%6
+} -returnCodes error -match glob -result *
+test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body {
+ expr 2*x
+} -returnCodes error -match glob -result *
test expr-12.10 {CompileMultiplyExpr: runtime error} {
list [catch {expr {24.0*"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "*"}}
@@ -561,14 +520,12 @@ test expr-13.4 {CompileUnaryExpr: unary exprs} {expr !2} 0
test expr-13.5 {CompileUnaryExpr: unary exprs} {expr +--+-62.0} -62.0
test expr-13.6 {CompileUnaryExpr: unary exprs} {expr !0.0} 1
test expr-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0
-test expr-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 expr-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}
+test expr-13.8 {CompileUnaryExpr: error compiling unary expr} -body {
+ expr ~x
+} -returnCodes error -match glob -result *
+test expr-13.9 {CompileUnaryExpr: error compiling unary expr} -body {
+ expr !1.x
+} -returnCodes error -match glob -result *
test expr-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "~"}}
@@ -633,15 +590,12 @@ test expr-14.15 {CompilePrimaryExpr: var reference primary} {
catch {expr $i.2} msg
set msg
} 123.2
-test expr-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 expr-14.17 {CompilePrimaryExpr: string primary that looks like var ref} {oldExprParser} {
+test expr-14.16 {CompilePrimaryExpr: error compiling var reference primary} -body {
+ expr {$a(foo}
+} -returnCodes error -match glob -result *
+test expr-14.17 {CompilePrimaryExpr: string primary that looks like var ref} -body {
expr $
-} $
+} -returnCodes error -match glob -result *
test expr-14.18 {CompilePrimaryExpr: quoted string primary} {
expr "21"
} 21
@@ -668,24 +622,18 @@ test expr-14.23 {CompilePrimaryExpr: error in subcommand primary} -body {
} -match glob -result {wrong # args: should be "set varName ?newValue?"
while *ing
"set"*}
-test expr-14.24 {CompilePrimaryExpr: error in subcommand primary} -constraints {oldExprParser} -body {
- catch {expr {[set i}} msg
- set errorInfo
-} -match glob -result {missing close-bracket
- while *ing
-"expr {\[set i}"}
+test expr-14.24 {CompilePrimaryExpr: error in subcommand primary} -body {
+ expr {[set i}
+} -returnCodes error -match glob -result *
test expr-14.25 {CompilePrimaryExpr: math function primary} {
format %.6g [expr exp(1.0)]
} 2.71828
test expr-14.26 {CompilePrimaryExpr: math function primary} {
format %.6g [expr pow(2.0+0.1,3.0+0.1)]
} 9.97424
-test expr-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*
- while *ing
-"expr sinh::(2.0)"}
+test expr-14.27 {CompilePrimaryExpr: error in math function primary} -body {
+ expr sinh::(2.0)
+} -returnCodes error -match glob -result *
test expr-14.28 {CompilePrimaryExpr: subexpression primary} {
expr 2+(3*4)
} 14
@@ -695,29 +643,20 @@ test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} -body {
} -match glob -result {wrong # args: should be "set varName ?newValue?"
while *ing
"set"*}
-test expr-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
- while *ing
-"expr 2+(3*(4+5)"}
+test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} -body {
+ expr 2+(3*(4+5)
+} -returnCodes error -match glob -result *
test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {
set i "5+10"
list "[expr $i] == 15" "[expr ($i)] == 15" "[eval expr ($i)] == 15"
} {{15 == 15} {15 == 15} {15 == 15}}
-test expr-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 expr-14.32 {CompilePrimaryExpr: unexpected token} -body {
+ expr @
+} -returnCodes error -match glob -result *
-test expr-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 $*
- while *ing
-"expr sinh2.0)"}
+test expr-15.1 {CompileMathFuncCall: missing parenthesis} -body {
+ expr sinh2.0)
+} -returnCodes error -match glob -result *
test expr-15.2 {CompileMathFuncCall: unknown math function} -body {
catch {expr whazzathuh(1)} msg
set errorInfo
@@ -742,12 +681,9 @@ test expr-15.5 {CompileMathFuncCall: too few arguments} -body {
} -match glob -result {too few arguments for math function*
while *ing
"expr pow(1)"}
-test expr-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
- while *ing
-"expr sin(1"}
+test expr-15.6 {CompileMathFuncCall: missing ')'} -body {
+ expr sin(1
+} -returnCodes error -match glob -result *
test expr-15.7 {CompileMathFuncCall: call registered math function} {testmathfunctions} {
expr 2*T1()
} 246
@@ -851,7 +787,7 @@ test expr-20.1 {wrong brace matching} {
set cmd "expr $l$q|$q == $q$r$q$r"
list [catch $cmd a] $a
} {1 {extra characters after close-brace}}
-test expr-20.2 {double invocation of variable traces} {oldExprParser} {
+test expr-20.2 {double invocation of variable traces} -body {
set exprtracecounter 0
proc exprtraceproc {args} {
upvar #0 exprtracecounter counter
@@ -869,7 +805,7 @@ test expr-20.2 {double invocation of variable traces} {oldExprParser} {
list [catch {expr "$exprtracevar + 20"} a] $a \
[catch {expr "$exprtracevar + 20"} b] $b \
[unset exprtracevar exprtracecounter]
-} {1 {syntax error in expression "1 oops 10 + 20": extra tokens at end of expression} 0 32 {}}
+} -match glob -result {1 * 0 32 {}}
test expr-20.3 {broken substitution of integer digits} {
# fails with 8.0.x, but not 8.1b2
list [set a 000; expr 0x1$a] [set a 1; expr ${a}000]
@@ -902,9 +838,9 @@ test expr-21.9 {non-numeric boolean literals} {expr !off } 1
test expr-21.10 {non-numeric boolean literals} {expr !on } 0
test expr-21.11 {non-numeric boolean literals} {expr !no } 1
test expr-21.12 {non-numeric boolean literals} {expr !yes } 0
-test expr-21.13 {non-numeric boolean literals} {oldExprParser} {
- list [catch {expr !truef} err] $err
-} {1 {syntax error in expression "!truef": the word "truef" requires a preceding $ if it's a variable or function arguments if it's a function}}
+test expr-21.13 {non-numeric boolean literals} -body {
+ expr !truef
+} -returnCodes error -match glob -result *
test expr-21.14 {non-numeric boolean literals} {
list [catch {expr !"truef"} err] $err
} {1 {can't use non-numeric string as operand of "!"}}
@@ -979,19 +915,16 @@ test expr-23.1 {CompileExponentialExpr: just exponential expr} {expr 4**2} 16
test expr-23.2 {CompileExponentialExpr: just exponential expr} {expr 0xff**2} 65025
test expr-23.3 {CompileExponentialExpr: just exponential expr} {expr -1**2} 1
test expr-23.4 {CompileExponentialExpr: just exponential expr} {expr 18**07} 612220032
-test expr-23.5 {CompileExponentialExpr: error in exponential expr} -constraints {oldExprParser} -body {
- catch {expr x**3} msg
- set msg
-} -match glob -result {syntax error in expression "x**3": * preceding $*}
+test expr-23.5 {CompileExponentialExpr: error in exponential expr} -body {
+ expr x**3
+} -returnCodes error -match glob -result *
test expr-23.6 {CompileExponentialExpr: simple expo exprs} {expr 0xff**0x3} 16581375
-test expr-23.7 {CompileExponentialExpr: error compiling expo arm} {oldExprParser} {
- catch {expr (-3-)**6} msg
- set msg
-} {syntax error in expression "(-3-)**6": unexpected close parenthesis}
-test expr-23.8 {CompileExponentialExpr: error compiling expo arm} -constraints {oldExprParser} -body {
- catch {expr 2**x} msg
- set msg
-} -match glob -result {syntax error in expression "2**x": * preceding $*}
+test expr-23.7 {CompileExponentialExpr: error compiling expo arm} -body {
+ expr (-3-)**6
+} -returnCodes error -match glob -result *
+test expr-23.8 {CompileExponentialExpr: error compiling expo arm} -body {
+ expr 2**x
+} -returnCodes error -match glob -result *
test expr-23.9 {CompileExponentialExpr: runtime error} {
list [catch {expr {24.0**"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "**"}}
@@ -6277,12 +6210,10 @@ test expr-39.2 {Tcl_ExprLongObj handles wide ints gracefully} testexprlongobj {
} {This is a result: 3}
test expr-39.3 {Tcl_ExprLongObj on the empty string} \
- -constraints {testexprlongobj oldExprParser}\
- -body {
- list [catch {testexprlongobj ""} result] $result
- } \
+ -constraints {testexprlongobj}\
+ -body {testexprlongobj ""} \
-match glob \
- -result {1 {syntax error*}}
+ -returnCodes error -result *
test expr-39.4 {Tcl_ExprLongObj coerces doubles} testexprlongobj {
testexprlongobj 3+.14159
} {This is a result: 3}
@@ -6344,12 +6275,10 @@ test expr-39.17 {Check that Tcl_ExprDoubleObj doesn't modify interpreter result
} {This is a result: 5.0}
#Check for [Bug 1109484]
test expr-39.18 {Tcl_ExprDoubleObj on the empty string} \
- -constraints {testexprdoubleobj oldExprParser} \
+ -constraints {testexprdoubleobj} \
-match glob \
- -body {
- list [catch {testexprdoubleobj ""} result] $result
- } \
- -result {1 {syntax error*}}
+ -body {testexprdoubleobj ""} \
+ -returnCodes error -result *
test expr-39.19 {Tcl_ExprDoubleObj coerces wides} testexprdoubleobj {
testexprdoubleobj 1[string repeat 0 17]
} {This is a result: 1e+17}
@@ -6373,7 +6302,7 @@ test expr-39.24 {Tcl_ExprDoubleObj handles overflows that look like int} \
testexprdoubleobj 17976931348623165[string repeat 0 292]
} {This is a result: Inf}
test expr-39.25 {Tcl_ExprDoubleObj and NaN} \
- {testexprdoubleobj ieeeFloatingPoint oldExprParser} {
+ {testexprdoubleobj ieeeFloatingPoint} {
list [catch {testexprdoubleobj 0.0/0.0} result] $result
} {1 {floating point value is Not a Number}}
diff --git a/tests/for.test b/tests/for.test
index 7051bac..a3a2d7d 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -9,17 +9,13 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: for.test,v 1.13 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: for.test,v 1.14 2006/08/22 04:03:24 dgp 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 "for" operation.
test for-1.1 {TclCompileForCmd: missing initial command} {
@@ -663,12 +659,16 @@ test for-6.6 {Tcl_ForObjCmd: error in initial command} -body {
("for" initial command)
invoked from within
"$z {set} {$i < 5} {incr i} {body}"}}
-test for-6.7 {Tcl_ForObjCmd: error in test expression} -constraints {oldExprParser} -match glob -body {
+test for-6.7 {Tcl_ForObjCmd: error in test expression} -body {
set z for
- list [catch {$z {set i 0} {i < 5} {incr i} {body}} msg] $msg $errorInfo
-} -result {1 {syntax error in expression "i < 5": * preceding $*} {syntax error in expression "i < 5": * preceding $*
- while executing
-"$z {set i 0} {i < 5} {incr i} {body}"}}
+ catch {$z {set i 0} {i < 5} {incr i} {body}}
+ set errorInfo
+} -result {invalid bareword "i"
+in expression "i < 5";
+should be "$i" or "{i}" or "i(...)" or ...
+ (parsing expression "i < 5")
+ invoked from within
+"$z {set i 0} {i < 5} {incr i} {body}"}
test for-6.8 {Tcl_ForObjCmd: test expression is enclosed in quotes} {
set z for
set i 0
diff --git a/tests/if.test b/tests/if.test
index 8a4ebf1..bbf10bc 100644
--- a/tests/if.test
+++ b/tests/if.test
@@ -10,17 +10,13 @@
# 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.9 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: if.test,v 1.10 2006/08/22 04:03:24 dgp 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}
@@ -30,10 +26,13 @@ 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} -constraints {oldExprParser} -body {
+test if-1.3 {TclCompileIfCmd: error in if/elseif test} -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
+} -result {1 {missing operand at _@_
+in expression "1+_@_"} {missing operand at _@_
+in expression "1+_@_"
+ (parsing expression "1+")
+ invoked from within
"if {1+}"}}
test if-1.4 {TclCompileIfCmd: if/elseif test in braces} {
set a {}
@@ -177,11 +176,14 @@ 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"} -constraints {oldExprParser} -body {
+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
-} -match glob -result {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression*
- while *ing
+} -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>}"}}
test if-2.5 {TclCompileIfCmd: test jumpFalse instruction replacement after long "elseif" body} {
catch {unset i}
@@ -505,11 +507,14 @@ 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} {oldExprParser} {
+test if-5.3 {if cmd with computed command names: error in if/elseif test} {
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
- while executing
+} {1 {missing operand at _@_
+in expression "1+_@_"} {missing operand at _@_
+in expression "1+_@_"
+ (parsing expression "1+")
+ invoked from within
"$z {1+}"}}
test if-5.4 {if cmd with computed command names: if/elseif test in braces} {
set z if
@@ -672,12 +677,15 @@ 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"} {oldExprParser} {
+test if-6.4 {if cmd with computed command names: error in expression after "elseif"} {
set z if
set a {}
list [catch {$z 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo
-} {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression
- while executing
+} {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>}"}}
test if-6.5 {if cmd with computed command names: test jumpFalse instruction replacement after long "elseif" body} {
set z if
@@ -1086,7 +1094,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} {oldExprParser} {
+test if-10.6 {double invocation of variable traces} {
set iftracecounter 0
proc iftraceproc {args} {
upvar #0 iftracecounter counter
@@ -1104,7 +1112,9 @@ test if-10.6 {double invocation of variable traces} {oldExprParser} {
list [catch {if "$iftracevar + 20" {}} a] $a \
[catch {if "$iftracevar + 20" {}} b] $b \
[unset iftracevar iftracecounter]
-} {1 {syntax error in expression "1 oops 10 + 20": extra tokens at end of expression} 0 {} {}}
+} {1 {invalid bareword "oops"
+in expression "1 oops 10 + 20";
+should be "$oops" or "{oops}" or "oops(...)" or ...} 0 {} {}}
# cleanup
::tcltest::cleanupTests
diff --git a/tests/parseExpr.test b/tests/parseExpr.test
index 4e5c926..3336203 100644
--- a/tests/parseExpr.test
+++ b/tests/parseExpr.test
@@ -8,17 +8,13 @@
# 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.23 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: parseExpr.test,v 1.24 2006/08/22 04:03:24 dgp 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
@@ -26,11 +22,6 @@ testConstraint oldExprParser [expr {![testConstraint newExprParser]}]
testConstraint testexprparser [llength [info commands testexprparser]]
-# Some tests only work if wide integers (>32bit) are not found to be
-# integers at all.
-
-testConstraint wideIs32bit [expr {0x80000000 < 0}]
-
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
@@ -97,193 +88,178 @@ test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} testexprpa
test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} testexprparser {
testexprparser "1 + 2" -1
} {- {} 0 subexpr {1 + 2} 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
-test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {testexprparser wideIs32bit} {
- list [catch {testexprparser {12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} testexprparser {
+ testexprparser 12345678901234567890 -1
+} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} \
- -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 oldExprParser} {
- list [catch {testexprparser {1+2 345} -1} msg] $msg
-} {1 {syntax error in expression "1+2 345": extra tokens at end of expression}}
+ -constraints testexprparser -body {
+ testexprparser {foo+} -1
+ } -match glob -returnCodes error -result *
+test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} -constraints testexprparser -body {
+ testexprparser {1+2 345} -1
+} -returnCodes error -match glob -result *
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 oldExprParser} -body {
- list [catch {testexprparser {0 || foo} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "0 || foo": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {0 || foo} -1
+ } -match glob -returnCodes error -result *
test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} testexprparser {
testexprparser {1+2} -1
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
test parseExpr-2.4 {ParseCondExpr procedure, next lexeme is "?"} testexprparser {
testexprparser {1+2 ? 3 : 4} -1
} {- {} 0 subexpr {1+2 ? 3 : 4} 11 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-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1+2 ? 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} testexprparser {
+ testexprparser {1+2 ? 12345678901234567890 : 0} -1
+} {- {} 0 subexpr {1+2 ? 12345678901234567890 : 0} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 subexpr 0 1 text 0 0 {}}
test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} testexprparser {
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 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 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}}
+ -constraints testexprparser -body {
+ testexprparser {1? fred : martha} -1
+ } -match glob -returnCodes error -result *
+test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} -constraints testexprparser -body {
+ testexprparser {1? 2 martha 3} -1
+} -returnCodes error -match glob -result *
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 oldExprParser} -body {
- list [catch {testexprparser {1? 2 : martha} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1? 2 : martha": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1? 2 : martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1&&foo || 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1&&foo || 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1&&foo || 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} testexprparser {
testexprparser {1&&2? 1 : 0} -1
} {- {} 0 subexpr {1&&2? 1 : 0} 11 operator ? 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-3.4 {ParseLorExpr procedure, next lexeme is "||"} testexprparser {
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.5 {ParseLorExpr procedure, bad lexeme after "||"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1&&2 || 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} testexprparser {
+ testexprparser {1&&2 || 12345678901234567890} -1
+} {- {} 0 subexpr {1&&2 || 12345678901234567890} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1&&2 || 3 || martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1&&foo && 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1&&foo && 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1&&foo && 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} testexprparser {
testexprparser {1|2? 1 : 0} -1
} {- {} 0 subexpr {1|2? 1 : 0} 11 operator ? 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-4.4 {ParseLandExpr procedure, next lexeme is "&&"} testexprparser {
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.5 {ParseLandExpr procedure, bad lexeme after "&&"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1|2 && 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} testexprparser {
+ testexprparser {1|2 && 12345678901234567890} -1
+} {- {} 0 subexpr {1|2 && 12345678901234567890} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1|2 && 3 && martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1|foo | 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1|foo | 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1|foo | 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} testexprparser {
testexprparser {1^2? 1 : 0} -1
} {- {} 0 subexpr {1^2? 1 : 0} 11 operator ? 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-5.4 {ParseBitOrExpr procedure, next lexeme is "|"} testexprparser {
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.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1^2 | 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} testexprparser {
+ testexprparser {1^2 | 12345678901234567890} -1
+} {- {} 0 subexpr {1^2 | 12345678901234567890} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1^2 | 3 | martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1^foo ^ 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1^foo ^ 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} testexprparser {
testexprparser {1&2? 1 : 0} -1
} {- {} 0 subexpr {1&2? 1 : 0} 11 operator ? 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-6.4 {ParseBitXorExpr procedure, next lexeme is "^"} testexprparser {
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.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1&2 ^ 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} testexprparser {
+ testexprparser {1&2 ^ 12345678901234567890} -1
+} {- {} 0 subexpr {1&2 ^ 12345678901234567890} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1&2 ^ 3 ^ martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1!=foo & 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1!=foo & 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1!=foo & 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} testexprparser {
testexprparser {1==2? 1 : 0} -1
} {- {} 0 subexpr {1==2? 1 : 0} 11 operator ? 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
test parseExpr-7.4 {ParseBitAndExpr procedure, next lexeme is "&"} testexprparser {
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.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1==2 & 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {testexprparser} {
+ testexprparser {1==2 & 12345678901234567890} -1
+} {- {} 0 subexpr {1==2 & 12345678901234567890} 9 operator & 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1==2 & 3>2 & martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1>=foo == 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1>=foo == 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1>=foo == 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} testexprparser {
testexprparser {1<2? 1 : 0} -1
} {- {} 0 subexpr {1<2? 1 : 0} 11 operator ? 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -293,26 +269,24 @@ test parseExpr-8.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} te
test parseExpr-8.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} testexprparser {
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.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1<2 == 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} testexprparser {
+ testexprparser {1<2 == 12345678901234567890} -1
+} {- {} 0 subexpr {1<2 == 12345678901234567890} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1<2 == 3 != martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1>=foo < 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1>=foo < 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1>=foo < 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} testexprparser {
testexprparser {1<<2? 1 : 0} -1
} {- {} 0 subexpr {1<<2? 1 : 0} 11 operator ? 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -328,26 +302,24 @@ test parseExpr-9.6 {ParseRelationalExpr procedure, next lexeme is relational op}
test parseExpr-9.7 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser {
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.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1<<2 < 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} testexprparser {
+ testexprparser {1<<2 < 12345678901234567890} -1
+} {- {} 0 subexpr {1<<2 < 12345678901234567890} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1<<2 < 3 > martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1-foo << 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1-foo << 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1-foo << 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} testexprparser {
testexprparser {1+2? 1 : 0} -1
} {- {} 0 subexpr {1+2? 1 : 0} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -357,26 +329,24 @@ test parseExpr-10.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} test
test parseExpr-10.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} testexprparser {
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.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1+2 << 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} testexprparser {
+ testexprparser {1+2 << 12345678901234567890} -1
+} {- {} 0 subexpr {1+2 << 12345678901234567890} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1+2 << 3 >> martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1/foo + 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1/foo + 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1/foo + 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser {
testexprparser {1*2? 1 : 0} -1
} {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -386,26 +356,24 @@ test parseExpr-11.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexpr
test parseExpr-11.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser {
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.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} testexprparser {
+ testexprparser {1*2 + 12345678901234567890} -1
+} {- {} 0 subexpr {1*2 + 12345678901234567890} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1*2 + 3 - martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {1/foo + 3} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "1/foo + 3": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {1/foo + 3} -1
+ } -match glob -returnCodes error -result *
test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser {
testexprparser {1*2? 1 : 0} -1
} {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -415,24 +383,23 @@ test parseExpr-12.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexpr
test parseExpr-12.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser {
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.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} testexprparser {
+ testexprparser {1*2 + 12345678901234567890} -1
+} {- {} 0 subexpr {1*2 + 12345678901234567890} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser {
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 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 $*}}
+ -constraints testexprparser -body {
+ testexprparser {1*2 + 3 - martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} testexprparser {
testexprparser {+2 * 3} -1
} {- {} 0 subexpr {+2 * 3} 7 operator * 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} {testexprparser wideIs32bit} {
- list [catch {testexprparser {-12345678901234567890 * 3} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} testexprparser {
+ testexprparser {-12345678901234567890 * 3} -1
+} {- {} 0 subexpr {-12345678901234567890 * 3} 7 operator * 0 subexpr -12345678901234567890 3 operator - 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 subexpr 3 1 text 3 0 {}}
test parseExpr-13.3 {ParseMultiplyExpr procedure, next lexeme isn't "*", "/", or "%"} testexprparser {
testexprparser {+2? 1 : 0} -1
} {- {} 0 subexpr {+2? 1 : 0} 9 operator ? 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -445,17 +412,16 @@ test parseExpr-13.5 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%
test parseExpr-13.6 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} testexprparser {
testexprparser {+-456 % 3} -1
} {- {} 0 subexpr {+-456 % 3} 9 operator % 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {testexprparser wideIs32bit} {
- list [catch {testexprparser {--++5 / 12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} testexprparser {
+ testexprparser {--++5 / 12345678901234567890} -1
+} {- {} 0 subexpr {--++5 / 12345678901234567890} 13 operator / 0 subexpr --++5 9 operator - 0 subexpr -++5 7 operator - 0 subexpr ++5 5 operator + 0 subexpr +5 3 operator + 0 subexpr 5 1 text 5 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} testexprparser {
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 oldExprParser} -body {
- list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg
- } -match glob \
- -result {1 {syntax error in expression "++2 / 3 * martha": * preceding $*}}
+ -constraints testexprparser -body {
+ testexprparser {++2 / 3 * martha} -1
+ } -match glob -returnCodes error -result *
test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} testexprparser {
testexprparser {+2} -1
@@ -469,46 +435,46 @@ test parseExpr-14.3 {ParseUnaryExpr procedure, first token is unary operator} te
test parseExpr-14.4 {ParseUnaryExpr procedure, first token is unary operator} testexprparser {
testexprparser {!2} -1
} {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}}
-test parseExpr-14.5 {ParseUnaryExpr procedure, error in lexeme after unary op} {testexprparser wideIs32bit} {
- list [catch {testexprparser {-12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-14.5 {ParseUnaryExpr procedure, error in lexeme after unary op} testexprparser {
+ testexprparser {-12345678901234567890} -1
+} {- {} 0 subexpr -12345678901234567890 3 operator - 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-14.6 {ParseUnaryExpr procedure, simple unary expr after unary op} testexprparser {
testexprparser {+"1234"} -1
} {- {} 0 subexpr +\"1234\" 3 operator + 0 subexpr {"1234"} 1 text 1234 0 {}}
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 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 oldExprParser} {
- list [catch {testexprparser {+-||27} -1} msg] $msg
-} {1 {syntax error in expression "+-||27": unexpected operator ||}}
+test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} -constraints testexprparser -body {
+ testexprparser {+-||27} -1
+} -returnCodes error -match glob -result *
+test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} -constraints testexprparser -body {
+ testexprparser {+-||27} -1
+} -returnCodes error -match glob -result *
test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} testexprparser {
testexprparser {123} -1
} {- {} 0 subexpr 123 1 text 123 0 {}}
test parseExpr-14.11 {ParseUnaryExpr procedure, not unary expr, complex primary expr} testexprparser {
testexprparser {(1+2)} -1
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
-test parseExpr-14.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} {testexprparser wideIs32bit} {
- list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-14.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} testexprparser {
+ testexprparser {(12345678901234567890)} -1
+} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-15.1 {ParsePrimaryExpr procedure, just parenthesized subexpr} testexprparser {
testexprparser {({abc}/{def})} -1
} {- {} 0 subexpr {{abc}/{def}} 5 operator / 0 subexpr {{abc}} 1 text abc 0 subexpr {{def}} 1 text def 0 {}}
-test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser wideIs32bit} {
- list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser} {
+ testexprparser {(12345678901234567890)} -1
+} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
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 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 oldExprParser} {
- list [catch {testexprparser {({abc}/{def}} -1} msg] $msg
-} {1 {syntax error in expression "({abc}/{def}": looking for close parenthesis}}
+test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} -constraints testexprparser -body {
+ testexprparser {(? 123 : 456)} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} -constraints testexprparser -body {
+ testexprparser {({abc}/{def}} -1
+} -returnCodes error -match glob -result *
test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} testexprparser {
testexprparser {12345} -1
} {- {} 0 subexpr 12345 1 text 12345 0 {}}
@@ -524,15 +490,15 @@ 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 oldExprParser} {
- list [catch {testexprparser {$a(} -1} msg] $msg
-} {1 {missing )}}
+test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} -constraints testexprparser -body {
+ testexprparser {$a(} -1
+} -returnCodes error -match glob -result *
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 oldExprParser} {
- list [catch {testexprparser {"$a(12"} -1} msg] $msg
-} {1 {missing )}}
+test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} -constraints testexprparser -body {
+ testexprparser {"$a(12"} -1
+} -returnCodes error -match glob -result *
test parseExpr-15.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} testexprparser {
testexprparser {"abc [xyz] $def"} -1
} {- {} 0 subexpr {"abc [xyz] $def"} 6 word {"abc [xyz] $def"} 5 text {abc } 0 command {[xyz]} 0 text { } 0 variable {$def} 1 text def 0 {}}
@@ -545,15 +511,15 @@ 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 oldExprParser} {
- list [catch {testexprparser {[one} -1} msg] $msg
-} {1 {missing close-bracket}}
+test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} -constraints testexprparser -body {
+ testexprparser {[one} -1
+} -returnCodes error -match glob -result *
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 oldExprParser} {
- list [catch {testexprparser "\{abc\\\n" -1} msg] $msg
-} {1 {missing close-brace}}
+test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} -constraints testexprparser -body {
+ testexprparser "\{abc\\\n" -1
+} -returnCodes error -match glob -result *
test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} testexprparser {
testexprparser "\{ \\
+123 \}" -1
@@ -561,51 +527,50 @@ test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with
test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} testexprparser {
testexprparser {foo(123)} -1
} {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}}
-test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {testexprparser wideIs32bit} {
- list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} -constraints testexprparser -body {
+ testexprparser {foo 12345678901234567890 123)} -1
+} -returnCodes error -match glob -result *
test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} \
- -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 $*}}
-test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser wideIs32bit} {
- list [catch {testexprparser {foo(12345678901234567890)} -1} msg] $msg
-} {1 {integer value too large to represent}}
+ -constraints testexprparser -body {
+ testexprparser {foo 27.4 123)} -1
+ } -match glob -returnCodes error -result *
+test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} testexprparser {
+ testexprparser {foo(12345678901234567890)} -1
+} {- {} 0 subexpr foo(12345678901234567890) 3 operator foo 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
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 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 oldExprParser} {
- list [catch {testexprparser {foo(*1-2)} -1} msg] $msg
-} {1 {syntax error in expression "foo(*1-2)": unexpected operator *}}
+test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} -constraints testexprparser -body {
+ testexprparser {foo(*1-2)} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} -constraints testexprparser -body {
+ testexprparser {foo(*1-2)} -1
+} -returnCodes error -match glob -result *
test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg} testexprparser {
testexprparser {foo(27-2, (-2*[foo]))} -1
} {- {} 0 subexpr {foo(27-2, (-2*[foo]))} 15 operator foo 0 subexpr 27-2 5 operator - 0 subexpr 27 1 text 27 0 subexpr 2 1 text 2 0 subexpr {-2*[foo]} 7 operator * 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr {[foo]} 1 command {[foo]} 0 {}}
-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 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 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 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 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 oldExprParser} {
+test parseExpr-15.30 {ParsePrimaryExpr procedure, bad lexeme after comma} testexprparser {
+ testexprparser {foo(123, 12345678901234567890)} -1
+} {- {} 0 subexpr {foo(123, 12345678901234567890)} 5 operator foo 0 subexpr 123 1 text 123 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
+test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} -constraints testexprparser -body {
+ testexprparser {foo(123 [foo])} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} -constraints testexprparser -body {
+ testexprparser {123 12345678901234567890} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} -constraints testexprparser -body {
+ testexprparser {123+,456} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} -constraints testexprparser -body {
+ testexprparser {123+=456} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} -constraints testexprparser -body {
+ testexprparser {(: 123 : 456)} -1
+} -returnCodes error -match glob -result *
+test parseExpr-15.36 {ParsePrimaryExpr procedure, missing close-bracket} -constraints testexprparser -body {
# Test for Bug 681841
- list [catch {testexprparser {[set a [format bc]} -1} msg] $msg
-} {1 {missing close-bracket}}
+ testexprparser {[set a [format bc]} -1
+} -returnCodes error -match glob -result *
test parseExpr-16.1 {GetLexeme procedure, whitespace before lexeme} testexprparser {
testexprparser { 123} -1
@@ -621,9 +586,9 @@ test parseExpr-16.3 {GetLexeme procedure, no lexeme after whitespace} testexprpa
test parseExpr-16.4 {GetLexeme procedure, integer lexeme} testexprparser {
testexprparser {000} -1
} {- {} 0 subexpr 000 1 text 000 0 {}}
-test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} {testexprparser wideIs32bit} {
- list [catch {testexprparser {12345678901234567890} -1} msg] $msg
-} {1 {integer value too large to represent}}
+test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} testexprparser {
+ testexprparser {12345678901234567890} -1
+} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -constraints testexprparser -body {
testexprparser {0999} -1
} -returnCodes error -match glob -result {*invalid octal number*}
@@ -645,9 +610,9 @@ 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 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.12 {GetLexeme procedure, bad double lexeme} -constraints testexprparser -body {
+ testexprparser {123.4x56} -1
+} -returnCodes error -match glob -result *
test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} testexprparser {
testexprparser {[foo]} -1
} {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}}
@@ -708,9 +673,9 @@ 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 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.33 {GetLexeme procedure, bad lexeme starting with "="} -constraints testexprparser -body {
+ testexprparser {2=+3} -1
+} -returnCodes error -match glob -result *
test parseExpr-16.34 {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 {}}
@@ -741,24 +706,24 @@ 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 oldExprParser} {
- list [catch {testexprparser {@27} -1} msg] $msg
-} {1 {syntax error in expression "@27": character not legal in expressions}}
+test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} -constraints testexprparser -body {
+ testexprparser {@27} -1
+} -returnCodes error -match glob -result *
test parseExpr-17.1 {PrependSubExprTokens procedure, expand token array} testexprparser {
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 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-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} -constraints testexprparser -body {
+ testexprparser {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1
+} -returnCodes error -match glob -result *
-test parseExpr-19.1 {TclParseInteger: [Bug 648441]} {oldExprParser} {
+test parseExpr-19.1 {TclParseInteger: [Bug 648441]} -body {
# 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
- list [catch {expr 0x} result] $result
-} [list 1 {syntax error in expression "0x": extra tokens at end of expression}]
+ expr 0x
+} -returnCodes error -match glob -result *
test parseExpr-20.1 {Bug 1451233} {
expr 1000000000000000000042
diff --git a/tests/while.test b/tests/while.test
index d317883..411ba20 100644
--- a/tests/while.test
+++ b/tests/while.test
@@ -10,17 +10,13 @@
# 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.10 2006/08/02 20:03:37 das Exp $
+# RCS: @(#) $Id: while.test,v 1.11 2006/08/22 04:03:24 dgp 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}
@@ -30,12 +26,14 @@ 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} -constraints {oldExprParser} -body {
+test while-1.2 {TclCompileWhileCmd: error in test expression} -body {
set i 0
catch {while {$i<} break} msg
set errorInfo
-} -match glob -result {syntax error in expression "$i<": premature end of expression*
- while *ing
+} -result {missing operand at _@_
+in expression "$i<_@_"
+ (parsing expression "$i<")
+ invoked from within
"while {$i<} break"}
test while-1.3 {TclCompileWhileCmd: error in test expression} {
set err [catch {while {"a"+"b"} {error "loop aborted"}} msg]
@@ -305,13 +303,15 @@ 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} {oldExprParser} {
+test while-4.3 {while (not compiled): error in test expression} {
set i 0
set z while
catch {$z {$i<} {set x 1}} msg
set errorInfo
-} {syntax error in expression "$i<": premature end of expression
- while executing
+} {missing operand at _@_
+in expression "$i<_@_"
+ (parsing expression "$i<")
+ invoked from within
"$z {$i<} {set x 1}"}
test while-4.4 {while (not compiled): error in test expression} {
set z while