diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2001-12-06 10:59:17 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2001-12-06 10:59:17 (GMT) |
commit | 6425a01b7a2896172c65f9883f0b56792a6fd263 (patch) | |
tree | e6c39593e08b79465eac7aa0dd4828dc16e96440 /tests/expr.test | |
parent | 5c1a1598d524e7cdba42a48aef9949ffd3802fd6 (diff) | |
download | tcl-6425a01b7a2896172c65f9883f0b56792a6fd263.zip tcl-6425a01b7a2896172c65f9883f0b56792a6fd263.tar.gz tcl-6425a01b7a2896172c65f9883f0b56792a6fd263.tar.bz2 |
More expr syntax error improvements
Diffstat (limited to 'tests/expr.test')
-rw-r--r-- | tests/expr.test | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/tests/expr.test b/tests/expr.test index 2233e53..c5b794a 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # 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.13 2001/12/04 15:36:29 dkf Exp $ +# RCS: @(#) $Id: expr.test,v 1.14 2001/12/06 10:59:18 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -138,7 +138,7 @@ 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": unexpected operator} +} {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 @@ -151,17 +151,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x||3": variable references require preceding $} 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": unexpected operator} +} {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": unexpected operator} +} {syntax error in expression "2>3?44:2**3": unexpected operator *} test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} {unixOnly nonPortable} { puts "Note: doing test expr-3.7 which can take several minutes to run" hello_world @@ -177,18 +177,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x&&3": variable references require preceding $} test expr-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1 test expr-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1 test expr-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1 test expr-4.6 {CompileLorExpr: error compiling lor arm} { catch {expr 2**3||4.0} msg set msg -} {syntax error in expression "2**3||4.0": unexpected operator} +} {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": unexpected operator} +} {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"}} @@ -202,7 +202,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x|3": variable references require preceding $} 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 @@ -210,11 +210,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": unexpected operator} +} {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": unexpected operator} +} {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"}} @@ -228,7 +228,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x|3": variable references require preceding $} 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 @@ -236,11 +236,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": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2^x": variable references require preceding $} 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 "^"}} @@ -255,7 +255,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x==3": variable references require preceding $} 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 @@ -263,11 +263,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": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2&x": variable references require preceding $} 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-7.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0 test expr-7.20 {CompileBitAndExpr: error in equality expr} { catch {expr xne3} msg set msg -} {syntax error in expression "xne3": expected a parenthesis enclosing function arguments} +} {syntax error in expression "xne3": variable references require preceding $} 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 @@ -288,7 +288,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x>3": variable references require preceding $} 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 @@ -296,11 +296,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": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2!=x": variable references require preceding $} test expr-8.14 {CompileBitAndExpr: equality expr} {expr {"a"eq"a"}} 1 test expr-8.14 {CompileBitAndExpr: equality expr} {expr {"\374" eq "ü"}} 1 test expr-8.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0 @@ -312,12 +312,12 @@ test expr-8.19 {CompileBitAndExpr: equality expr} {expr {"abc" ne "abd"}} 1 test expr-8.20 {CompileBitAndExpr: error in equality expr} { catch {expr x ne3} msg set msg -} {syntax error in expression "x ne3": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x ne3": variable references require preceding $} test expr-8.21 {CompileBitAndExpr: error in equality expr} { # These should be ""ed to avoid the error catch {expr a eq b} msg set msg -} {syntax error in expression "a eq b": expected a parenthesis enclosing function arguments} +} {syntax error in expression "a eq b": variable references require preceding $} test expr-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12 test expr-9.2 {CompileRelationalExpr: just shift expr} {expr 0xff>>2} 63 @@ -339,17 +339,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x>>3": variable references require preceding $} test expr-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1 test expr-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1 test expr-9.9 {CompileRelationalExpr: error compiling relational arm} { catch {expr 2**3>6} msg set msg -} {syntax error in expression "2**3>6": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2<x": variable references require preceding $} test expr-10.1 {CompileShiftExpr: just add expr} {expr 4+-2} 2 test expr-10.2 {CompileShiftExpr: just add expr} {expr 0xff-2} 253 @@ -358,17 +358,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x+3": variable references require preceding $} 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": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2<<x": variable references require preceding $} 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 ">>"}} @@ -383,17 +383,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "x*3": variable references require preceding $} 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": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2-x": variable references require preceding $} 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 "+"}} @@ -414,17 +414,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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "~x": variable references require preceding $} 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": unexpected operator} +} {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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "2*x": variable references require preceding $} 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 "*"}} @@ -442,7 +442,7 @@ 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": expected a parenthesis enclosing function arguments} +} {syntax error in expression "~x": variable references require preceding $} test expr-13.9 {CompileUnaryExpr: error compiling unary expr} { catch {expr !1.x} msg set msg @@ -563,7 +563,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)": expected a parenthesis enclosing function arguments +} {syntax error in expression "sinh::(2.0)": expected parenthesis enclosing function arguments while compiling "expr sinh::(2.0)"} test expr-14.28 {CompilePrimaryExpr: subexpression primary} { @@ -597,7 +597,7 @@ test expr-14.32 {CompilePrimaryExpr: unexpected token} { test expr-15.1 {CompileMathFuncCall: missing parenthesis} { catch {expr sinh2.0)} msg set errorInfo -} {syntax error in expression "sinh2.0)": expected a parenthesis enclosing function arguments +} {syntax error in expression "sinh2.0)": variable references require preceding $ while compiling "expr sinh2.0)"} test expr-15.2 {CompileMathFuncCall: unknown math function} { |