aboutsummaryrefslogtreecommitdiff
path: root/tests/expr.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2016-04-19 23:15:54 +1000
committerSteve Bennett <steveb@workware.net.au>2016-08-17 16:03:08 +1000
commit6746b6fa2b65793c80468e79647b5cecfb50340f (patch)
tree70818b90b47aac48a73a55a96b745585260d2bc9 /tests/expr.test
parente930051115fef44a4f1a3214969169fb5b6d924d (diff)
downloadjimtcl-6746b6fa2b65793c80468e79647b5cecfb50340f.zip
jimtcl-6746b6fa2b65793c80468e79647b5cecfb50340f.tar.gz
jimtcl-6746b6fa2b65793c80468e79647b5cecfb50340f.tar.bz2
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 <steveb@workware.net.au>
Diffstat (limited to 'tests/expr.test')
-rw-r--r--tests/expr.test25
1 files changed, 12 insertions, 13 deletions
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}