From 6746b6fa2b65793c80468e79647b5cecfb50340f Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Tue, 19 Apr 2016 23:15:54 +1000 Subject: expr: fix adjacent terms in function calls Previously two adjacent terms were incorrectly accepted, such as in pow(2 3) Correctly generate an error in this case and improve the error message when an expression fails to parse correctly. Signed-off-by: Steve Bennett --- tests/expr.test | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'tests/expr.test') diff --git a/tests/expr.test b/tests/expr.test index 682af89..dbe84f5 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -83,22 +83,21 @@ test expr-1.17 "Rotate left" jim { } {2} # This crashes older jim -test expr-2.1 "bogus unarymin" { - catch {expr {unarymin 1}} - return 1 -} {1} +test expr-2.1 "bogus unarymin" -body { + expr {unarymin 1} +} -returnCodes error -match glob -result * -test expr-2.2 "Ternary operator - missing colon" { - list [catch {expr {1 ? 2 3}} msg] -} {1} +test expr-2.2 "Ternary operator - missing colon" -body { + expr {1 ? 2 3} +} -returnCodes error -match glob -result {missing operator*} -test expr-2.3 "Ternary operator - missing third term" { - list [catch {expr {1 ? 2}} msg] -} {1} +test expr-2.3 "Ternary operator - missing third term" -body { + expr {1 ? 2} +} -returnCodes error -match glob -result * -test expr-2.4 "Ternary operator - missing question" { - list [catch {expr {1 : 2}} msg] -} {1} +test expr-2.4 "Ternary operator - missing question" -body { + expr {1 : 2} +} -returnCodes error -match glob -result * test expr-3.1 "in, ni operators" { set l {a b c d} -- cgit v1.1