summaryrefslogtreecommitdiffstats
path: root/tests/compExpr-old.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2001-12-04 15:36:29 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2001-12-04 15:36:29 (GMT)
commit5135eae0433e9c4fb96153356cce8f29f72c09a8 (patch)
tree274a2df1f90321771b312de400142f588d5eb264 /tests/compExpr-old.test
parent1b5d4aa57d4fd6ffb21d7f5a0c08567eb0959714 (diff)
downloadtcl-5135eae0433e9c4fb96153356cce8f29f72c09a8.zip
tcl-5135eae0433e9c4fb96153356cce8f29f72c09a8.tar.gz
tcl-5135eae0433e9c4fb96153356cce8f29f72c09a8.tar.bz2
Improved messages produced on getting a syntax error in an expression
Diffstat (limited to 'tests/compExpr-old.test')
-rw-r--r--tests/compExpr-old.test92
1 files changed, 40 insertions, 52 deletions
diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test
index f7bb24f..ea54db1 100644
--- a/tests/compExpr-old.test
+++ b/tests/compExpr-old.test
@@ -12,7 +12,7 @@
# 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.5 2000/04/10 17:18:57 ericm Exp $
+# RCS: @(#) $Id: compExpr-old.test,v 1.6 2001/12/04 15:36:29 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -135,11 +135,11 @@ test expr-2.1 {TclCompileExpr: are builtin functions registered?} {
test expr-2.2 {TclCompileExpr: error in expr} {
catch {expr 2**3} msg
set msg
-} {syntax error in expression "2**3"}
+} {syntax error in expression "2**3": unexpected operator}
test expr-2.3 {TclCompileExpr: junk after legal expr} {
catch {expr 7*[llength "a b"]foo} msg
set msg
-} {syntax error in expression "7*2foo"}
+} {syntax error in expression "7*2foo": extra tokens at end of expression}
test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} {
expr {0001}
} 1
@@ -148,17 +148,17 @@ test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1
test expr-3.2 {CompileCondExpr: error in lor expr} {
catch {expr x||3} msg
set msg
-} {syntax error in expression "x||3"}
+} {syntax error in expression "x||3": expected a parenthesis enclosing function arguments}
test expr-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44
test expr-3.4 {CompileCondExpr: error compiling true arm} {
catch {expr 3>2?2**3:66} msg
set msg
-} {syntax error in expression "3>2?2**3:66"}
+} {syntax error in expression "3>2?2**3:66": unexpected operator}
test expr-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66
test expr-3.6 {CompileCondExpr: error compiling false arm} {
catch {expr 2>3?44:2**3} msg
set msg
-} {syntax error in expression "2>3?44:2**3"}
+} {syntax error in expression "2>3?44:2**3": unexpected operator}
test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} {nonPortable} {
puts "Note: doing test expr-3.7 which can take several minutes to run"
hello_world
@@ -174,18 +174,18 @@ test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1
test expr-4.2 {CompileLorExpr: error in land expr} {
catch {expr x&&3} msg
set msg
-} {syntax error in expression "x&&3"}
+} {syntax error in expression "x&&3": expected a parenthesis enclosing function arguments}
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} {
catch {expr 2**3||4.0} msg
set msg
-} {syntax error in expression "2**3||4.0"}
+} {syntax error in expression "2**3||4.0": unexpected operator}
test expr-4.7 {CompileLorExpr: error compiling lor arm} {
catch {expr 1.3||2**3} msg
set msg
-} {syntax error in expression "1.3||2**3"}
+} {syntax error in expression "1.3||2**3": unexpected operator}
test expr-4.8 {CompileLorExpr: error compiling lor arms} {
list [catch {expr {"a"||"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -199,7 +199,7 @@ test expr-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23
test expr-5.2 {CompileLandExpr: error in bitor expr} {
catch {expr x|3} msg
set msg
-} {syntax error in expression "x|3"}
+} {syntax error in expression "x|3": expected a parenthesis enclosing function arguments}
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
@@ -207,11 +207,11 @@ test expr-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1
test expr-5.7 {CompileLandExpr: error compiling land arm} {
catch {expr 2**3&&4.0} msg
set msg
-} {syntax error in expression "2**3&&4.0"}
+} {syntax error in expression "2**3&&4.0": unexpected operator}
test expr-5.8 {CompileLandExpr: error compiling land arm} {
catch {expr 1.3&&2**3} msg
set msg
-} {syntax error in expression "1.3&&2**3"}
+} {syntax error in expression "1.3&&2**3": unexpected operator}
test expr-5.9 {CompileLandExpr: error compiling land arm} {
list [catch {expr {"a"&&"b"}} msg] $msg
} {1 {expected boolean value but got "a"}}
@@ -225,7 +225,7 @@ test expr-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3
test expr-6.2 {CompileBitXorExpr: error in bitand expr} {
catch {expr x|3} msg
set msg
-} {syntax error in expression "x|3"}
+} {syntax error in expression "x|3": expected a parenthesis enclosing function arguments}
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
@@ -233,11 +233,11 @@ test expr-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8
test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} {
catch {expr 2**3|6} msg
set msg
-} {syntax error in expression "2**3|6"}
+} {syntax error in expression "2**3|6": unexpected operator}
test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} {
catch {expr 2^x} msg
set msg
-} {syntax error in expression "2^x"}
+} {syntax error in expression "2^x": expected a parenthesis enclosing function arguments}
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 "^"}}
@@ -252,7 +252,7 @@ test expr-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0
test expr-7.5 {CompileBitAndExpr: error in equality expr} {
catch {expr x==3} msg
set msg
-} {syntax error in expression "x==3"}
+} {syntax error in expression "x==3": expected a parenthesis enclosing function arguments}
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
@@ -260,11 +260,11 @@ test expr-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7
test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} {
catch {expr 2**3&6} msg
set msg
-} {syntax error in expression "2**3&6"}
+} {syntax error in expression "2**3&6": unexpected operator}
test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} {
catch {expr 2&x} msg
set msg
-} {syntax error in expression "2&x"}
+} {syntax error in expression "2&x": expected a parenthesis enclosing function arguments}
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 "&"}}
@@ -279,7 +279,7 @@ test expr-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0
test expr-8.5 {CompileEqualityExpr: error in relational expr} {
catch {expr x>3} msg
set msg
-} {syntax error in expression "x>3"}
+} {syntax error in expression "x>3": expected a parenthesis enclosing function arguments}
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
@@ -287,11 +287,11 @@ test expr-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1
test expr-8.10 {CompileEqualityExpr: error compiling equality arm} {
catch {expr 2**3==6} msg
set msg
-} {syntax error in expression "2**3==6"}
+} {syntax error in expression "2**3==6": unexpected operator}
test expr-8.11 {CompileEqualityExpr: error compiling equality arm} {
catch {expr 2!=x} msg
set msg
-} {syntax error in expression "2!=x"}
+} {syntax error in expression "2!=x": expected a parenthesis enclosing function arguments}
test expr-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12
@@ -314,17 +314,17 @@ if {0x80000000 > 0} {
test expr-9.6 {CompileRelationalExpr: error in shift expr} {
catch {expr x>>3} msg
set msg
-} {syntax error in expression "x>>3"}
+} {syntax error in expression "x>>3": expected a parenthesis enclosing function arguments}
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} {
catch {expr 2**3>6} msg
set msg
-} {syntax error in expression "2**3>6"}
+} {syntax error in expression "2**3>6": unexpected operator}
test expr-9.10 {CompileRelationalExpr: error compiling relational arm} {
catch {expr 2<x} msg
set msg
-} {syntax error in expression "2<x"}
+} {syntax error in expression "2<x": expected a parenthesis enclosing function arguments}
test expr-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2
test expr-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253
@@ -333,17 +333,17 @@ test expr-10.4 {CompileShiftExpr: just add expr} {expr 1-0123} -82
test expr-10.5 {CompileShiftExpr: error in add expr} {
catch {expr x+3} msg
set msg
-} {syntax error in expression "x+3"}
+} {syntax error in expression "x+3": expected a parenthesis enclosing function arguments}
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} {
catch {expr 2**3>>6} msg
set msg
-} {syntax error in expression "2**3>>6"}
+} {syntax error in expression "2**3>>6": unexpected operator}
test expr-10.9 {CompileShiftExpr: error compiling shift arm} {
catch {expr 2<<x} msg
set msg
-} {syntax error in expression "2<<x"}
+} {syntax error in expression "2<<x": expected a parenthesis enclosing function arguments}
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 ">>"}}
@@ -358,17 +358,17 @@ test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6
test expr-11.5 {CompileAddExpr: error in multiply expr} {
catch {expr x*3} msg
set msg
-} {syntax error in expression "x*3"}
+} {syntax error in expression "x*3": expected a parenthesis enclosing function arguments}
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} {
catch {expr 2**3+6} msg
set msg
-} {syntax error in expression "2**3+6"}
+} {syntax error in expression "2**3+6": unexpected operator}
test expr-11.9 {CompileAddExpr: error compiling add arm} {
catch {expr 2-x} msg
set msg
-} {syntax error in expression "2-x"}
+} {syntax error in expression "2-x": expected a parenthesis enclosing function arguments}
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 "+"}}
@@ -389,17 +389,17 @@ test expr-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936
test expr-12.5 {CompileMultiplyExpr: error in unary expr} {
catch {expr ~x} msg
set msg
-} {syntax error in expression "~x"}
+} {syntax error in expression "~x": expected a parenthesis enclosing function arguments}
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} {
catch {expr 2*3%%6} msg
set msg
-} {syntax error in expression "2*3%%6"}
+} {syntax error in expression "2*3%%6": unexpected operator}
test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} {
catch {expr 2*x} msg
set msg
-} {syntax error in expression "2*x"}
+} {syntax error in expression "2*x": expected a parenthesis enclosing function arguments}
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 "*"}}
@@ -417,11 +417,11 @@ test expr-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0
test expr-13.8 {CompileUnaryExpr: error compiling unary expr} {
catch {expr ~x} msg
set msg
-} {syntax error in expression "~x"}
+} {syntax error in expression "~x": expected a parenthesis enclosing function arguments}
test expr-13.9 {CompileUnaryExpr: error compiling unary expr} {
catch {expr !1.x} msg
set msg
-} {syntax error in expression "!1.x"}
+} {syntax error in expression "!1.x": extra tokens at end of expression}
test expr-13.10 {CompileUnaryExpr: runtime error} {
list [catch {expr {~"xx"}} msg] $msg
} {1 {can't use non-numeric string as operand of "~"}}
@@ -533,7 +533,7 @@ test expr-14.26 {CompilePrimaryExpr: math function primary} {
test expr-14.27 {CompilePrimaryExpr: error in math function primary} {
catch {expr sinh::(2.0)} msg
set errorInfo
-} {syntax error in expression "sinh::(2.0)"
+} {syntax error in expression "sinh::(2.0)": expected a parenthesis enclosing function arguments
while compiling
"expr sinh::(2.0)"}
test expr-14.28 {CompilePrimaryExpr: subexpression primary} {
@@ -550,7 +550,7 @@ test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} {
test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} {
catch {expr 2+(3*(4+5)} msg
set errorInfo
-} {syntax error in expression "2+(3*(4+5)"
+} {syntax error in expression "2+(3*(4+5)": looking for close parenthesis
while compiling
"expr 2+(3*(4+5)"}
test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {
@@ -560,14 +560,14 @@ test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} {
test expr-14.32 {CompilePrimaryExpr: unexpected token} {
catch {expr @} msg
set errorInfo
-} {syntax error in expression "@"
+} {syntax error in expression "@": character not legal in expressions
while compiling
"expr @"}
test expr-15.1 {CompileMathFuncCall: missing parenthesis} {
catch {expr sinh2.0)} msg
set errorInfo
-} {syntax error in expression "sinh2.0)"
+} {syntax error in expression "sinh2.0)": expected a parenthesis enclosing function arguments
while compiling
"expr sinh2.0)"}
test expr-15.2 {CompileMathFuncCall: unknown math function} {
@@ -597,7 +597,7 @@ test expr-15.5 {CompileMathFuncCall: too few arguments} {
test expr-15.6 {CompileMathFuncCall: missing ')'} {
catch {expr sin(1} msg
set errorInfo
-} {syntax error in expression "sin(1"
+} {syntax error in expression "sin(1": missing close parenthesis at end of function call
while compiling
"expr sin(1"}
if $gotT1 {
@@ -676,15 +676,3 @@ if {[info exists a]} {
}
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-