aboutsummaryrefslogtreecommitdiff
path: root/tests
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
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')
-rw-r--r--tests/expr-old.test2
-rw-r--r--tests/expr.test25
2 files changed, 13 insertions, 14 deletions
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 0bd9b53..f5422eb 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -747,7 +747,7 @@ test expr-old-34.2 {errors in math functions} -body {
test expr-old-34.3 {errors in math functions} -body {
expr {hypot("a b", 2.0)}
} -returnCodes error -match glob -result *
-test expr-old-34.4 {errors in math functions} -constraints tcl -body {
+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 {
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}