aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2017-05-12 13:33:44 +1000
committerSteve Bennett <steveb@workware.net.au>2017-05-23 14:36:56 +1000
commitbd5139c89e714bb7e10a0da55d9a10f51e93516c (patch)
treea1fb42986a3abc588e05f0b7eea4361c723f779c /tests
parent7b2250a7e60968b0c3716a7caa780e6ca0a2ce9b (diff)
downloadjimtcl-bd5139c89e714bb7e10a0da55d9a10f51e93516c.zip
jimtcl-bd5139c89e714bb7e10a0da55d9a10f51e93516c.tar.gz
jimtcl-bd5139c89e714bb7e10a0da55d9a10f51e93516c.tar.bz2
expr: Replace expression engine
Rework the expression engine to use recursive descent evaluation rather than a shunting yard algorithm. Among other things, it is easier to make lazy operators and the ternary operator work correctly. In particular, the following expression no longer crashes: $(99?9,99?9:*9:999)?9) And the code is now smaller. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/expr.test8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/expr.test b/tests/expr.test
index dbe84f5..b195d4a 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -99,6 +99,14 @@ test expr-2.4 "Ternary operator - missing question" -body {
expr {1 : 2}
} -returnCodes error -match glob -result *
+test expr-2.5 "Ternary operator with -ve values" {
+ expr {-1?-2:-3}
+} -2
+
+test expr-2.6 "Ternary operator with -ve values" {
+ expr {0?-2:-3}
+} -3
+
test expr-3.1 "in, ni operators" {
set l {a b c d}
set c C