aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2022-12-10 07:56:44 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2022-12-10 07:56:44 +0300
commit247884ab43025408c9f717ce2f15b6b725f74159 (patch)
treeca63cf1cf9f924bf415bfc793e64006941df9e7d /tests
parent351d07a7f79049a92a35feb588f13a571d6d1c89 (diff)
downloadsciteco-247884ab43025408c9f717ce2f15b6b725f74159.tar.gz
fixed pass-through loops: especially :> and :F<
* fixes test cases like 3<%a:> * you can now use :F< in pass-through loops as well * F> outside of loops will now exit the current macro level. This is analogous to what TECO-11 did. In interactive mode, F> is currently also equivalent to $$ (terminates command line).
Diffstat (limited to 'tests')
-rw-r--r--tests/testsuite.at29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at
index e604c7f..abb3aa6 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -16,6 +16,17 @@ AT_COLOR_TESTS
AT_BANNER([Features])
+AT_SETUP([Number stack])
+AT_CHECK([$SCITECO -e "2%a,%a - 3\"N(0/0)'"], 0, ignore, ignore)
+# It's not quite clear what would be the best semantics for comma:
+# a) Superfluous commas as in ",," or "(1,)" should be an error.
+# b) Superfluous commas should be ignored which is effectively what we do now.
+# Even then it might be advisable to treat (1,) like (1).
+# c) The empty "list" element is equivalent to 0, so
+# "1,,2" is equivalent to "1,0,2" and (1,) to (1,0).
+AT_CHECK([$SCITECO -e "(1,) \"~|(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
AT_SETUP([Missing left operand])
AT_CHECK([$SCITECO -e '+23='], 1, ignore, ignore)
AT_CLEANUP
@@ -24,6 +35,15 @@ AT_SETUP([Closing loops at the correct macro level])
AT_CHECK([$SCITECO -e '@^Ua{>} <Ma'], 1, ignore, ignore)
AT_CLEANUP
+AT_SETUP([Pass-through loops])
+# NOTE: This requires the <=>, so that values get consumed from the stack.
+# More elegant would be a command for popping exactly one argument like <:$>.
+AT_CHECK([$SCITECO -e "1,2,3,-1:<\"~1;'%a=> Qa-6\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "1,2,3,-1:<\"~1;'%a= F>(0/0)> Qa-6\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "3<%a:>-3\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "3<%a :F>(0/0):>-3\"N(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
AT_SETUP([String arguments])
AT_CHECK([$SCITECO -e $'Ifoo^Q\e(0/0)\e'], 0, ignore, ignore)
AT_CHECK([$SCITECO -e '@I"foo^Q"(0/0)"'], 0, ignore, ignore)
@@ -113,6 +133,15 @@ AT_CLEANUP
AT_BANNER([Known Bugs])
+AT_SETUP([Number stack])
+# Nobody needs the current semantic of digit "commands" and they
+# will be replaced with proper number parser states, which will also allow for
+# floating point constants.
+# With the current parser, it is hard to even interpret the following code correctly...
+AT_CHECK([$SCITECO -e "(12)3 - 3\"N(0/0)'"], 0, ignore, ignore)
+AT_XFAIL_IF(true)
+AT_CLEANUP
+
AT_SETUP([Dangling Else/End-If])
AT_CHECK([$SCITECO -e "'"], 1, ignore, ignore)
AT_CHECK([$SCITECO -e "| (0/0) '"], 1, ignore, ignore)