aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/testsuite.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testsuite.at')
-rw-r--r--tests/testsuite.at88
1 files changed, 83 insertions, 5 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 20a72ca..676ca59 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -13,6 +13,8 @@ AT_COLOR_TESTS
# (translated to [ ... ]) in simple cases where balanced
# brackets are required in TECO code as well and
# quadrigraphs (@<:@ and @:>@) in all other cases.
+# Single round brackets also have to be replaced with the
+# quadrigraphs @{:@ and @:}@.
AT_BANNER([Features])
@@ -25,6 +27,16 @@ AT_CHECK([$SCITECO -e "2%a,%a - 3\"N(0/0)'"], 0, ignore, ignore)
# 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_CHECK([$SCITECO -e "1,(2)=="], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Exponentiation])
+AT_CHECK([$SCITECO -e "-1^*0 - (-1)\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "-1^*-5 - (-1)\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "0^*-5="], 1, ignore, ignore)
+AT_CHECK([$SCITECO -e "0^*0 - 1\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "1^*-5 - 1\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "2^*-5 - 0\"N(0/0)'"], 0, ignore, ignore)
AT_CLEANUP
AT_SETUP([Missing left operand])
@@ -35,6 +47,11 @@ AT_SETUP([Closing loops at the correct macro level])
AT_CHECK([$SCITECO -e '@^Ua{>} <Ma'], 1, ignore, ignore)
AT_CLEANUP
+AT_SETUP([Braces in loops])
+AT_CHECK([$SCITECO -e "1<23@{:@42>"], 1, ignore, ignore)
+AT_CHECK([$SCITECO -e "1<23(1;)> \"~|(0/0)'"], 0, 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 <:$>.
@@ -63,8 +80,53 @@ AT_CHECK([$SCITECO -e '0U[[AB^Q@:>@(0/0)]]'], 0, ignore, ignore)
# TODO: String building in Q-Register definitions
AT_CLEANUP
-AT_SETUP([8-bit cleanlyness])
-AT_CHECK([$SCITECO -e "0:@EUa/f^@^@/ :Qa-4\"N(0/0)' Ga Z= Z-4\"N(0/0)'"], 0, ignore, ignore)
+AT_SETUP([Q-Register stack])
+AT_CHECK([$SCITECO -e "[[a 23Ub ]]b Qb\"N(0/0)'"], 0, ignore, ignore)
+# FG will temporarily change the working directory to tests/testsuite.dir.
+AT_CHECK([$SCITECO -e "[[\$ @FG'..' ]]\$ :Q\$-1Q\$-^^r\"=(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Searches])
+# FIXME: We cannot currently easily insert a single ASCII 5 (^E), as it must be followed
+# by a 2nd character. It can be quoted, but cannot be written as Caret+E.
+# You also cannot search for a single ASCII 5 using Caret+E.
+# 2 additional ^Q are translated to a single ^Q and interpreted at the search-pattern layer.
+AT_CHECK([$SCITECO -e "@I/^Q\05/ J @:S/^Q^Q^Q\05/\"F(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Editing local registers in macro calls])
+AT_CHECK([$SCITECO -e '@^Ua{@EQ.x//} :Ma @^U.x/FOO/'], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e '@^Ua{@EQ.x//} Ma @^U.x/FOO/'], 1, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Loading files into Q-Registers])
+AT_CHECK([$SCITECO -e "@I/../ @EW/loadqreg.txt/ @EQa/loadqreg.txt/ :Qa-2\"N(0/0)'"], 0, ignore, ignore)
+# Does the same as FG..$. Afterwards, the parent directory should be shorter.
+AT_CHECK([$SCITECO -e ":Q\$Ul @EQ\$/loadqreg.txt/ :Q\$-Ql+1\">(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Saving Q-Registers contents to files])
+AT_CHECK([$SCITECO -e "@^Ua/test/ @E%a/saveqreg.txt/ @EB/saveqreg.txt/ Z-4\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "@E%\$/saveqreg.txt/ @EB/saveqreg.txt/ Z-:Q\$\"N(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([8-bit cleanliness])
+AT_CHECK([$SCITECO -e "0@I//J 0A\"N(0/0)' :@S/^@/\"F(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "@EQa//0EE 1U*0EE 0:@EUa/f^@^@/ :Qa-4\"N(0/0)' Ga Z-4\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "0EE 129@I// -A-129\"N(0/0)' HXa @EQa// EE\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -8e "129@:^Ua// 0Qa-129\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "1EE 167Ua @I/^EUa/ .-1\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -8e "194Ua Qa@I//J :@S/^EUa/\"F(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Unicode])
+AT_CHECK([$SCITECO -e "8594@I/Здравствуй, мир!/ Z-17\"N(0/0)' J0A-8594\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "8594@^Ua/Здравствуй, мир!/ :Qa-17\"N(0/0)' 0Qa-8594\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "@I/Здравствуй, мир!/ JW .-10\"N(0/0)' ^E-20\"N(0/0)' 204:EE .-10\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "@I/TEST/ @EW/юникод.txt/"], 0, ignore, ignore)
+AT_CHECK([test -f юникод.txt], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "^^ß-223\"N(0/0) 23Uъ Q[Ъ]-23\"N(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "@O/метка/ !метка!"], 0, ignore, ignore)
AT_CLEANUP
AT_SETUP([Automatic EOL normalization])
@@ -104,11 +166,20 @@ AT_CHECK([$SCITECO -e "2147483647@S/foo/"], 0, ignore, ignore)
AT_CHECK([$SCITECO -e "-2147483648@S/foo/"], 1, ignore, ignore)
AT_CLEANUP
+AT_SETUP([Search on new empty document])
+AT_CHECK([$SCITECO -e ":@S/foo/\"S(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
AT_SETUP([Memory limiting during spawning])
# This might result in an OOM if memory limiting is not working
AT_CHECK([$SCITECO -e "50*1000*1000,2EJ 0,128ED @EC'dd if=/dev/zero'"], 1, ignore, ignore)
AT_CLEANUP
+AT_SETUP([Memory limiting during file reading])
+AT_CHECK([dd if=/dev/zero of=big-file.txt bs=1000 count=50000], 0, ignore, ignore)
+AT_CHECK([$SCITECO -8e "50*1000*1000,2EJ @EB'big-file.txt'"], 1, ignore, ignore)
+AT_CLEANUP
+
AT_SETUP([Q-Register stack cleanup])
AT_CHECK([$SCITECO -e '@<:@a'], 0, ignore, ignore)
AT_CLEANUP
@@ -131,6 +202,15 @@ AT_SETUP([Empty lexer name])
AT_CHECK([$SCITECO -e '@ES/SETILEXER//'], 1, ignore, ignore)
AT_CLEANUP
+AT_SETUP([Empty command string])
+AT_CHECK([$SCITECO -e '@EC//'], 1, ignore, ignore)
+AT_CHECK([$SCITECO -e '@EGa//'], 1, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Jump to beginning of macro])
+AT_CHECK([$SCITECO -e "%a-2\"< F< ' Qa-2\"N(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
AT_BANNER([Known Bugs])
AT_SETUP([Number stack])
@@ -150,6 +230,7 @@ AT_CLEANUP
# NOTE: This bug depends on specific build options of Glib's
# PCRE which is not predictable.
+# It segfaults at least on Ubuntu 20.04 (libpcre3 v2:8.39).
#AT_SETUP([Pattern matching overflow])
## Should no longer dump core.
## It could fail because the memory limit is exceeed,
@@ -159,9 +240,6 @@ AT_CLEANUP
#AT_CLEANUP
AT_SETUP([Recursion overflow])
-# On Mac OS and FreeBSD we cannot always reliably provoke a stack overflow.
-# Let's suppose this is the case on all BSDs.
-AT_SKIP_IF([case $host in *-*-*bsd* | *-*-darwin*) true;; *) false;; esac])
# Should no longer dump core.
# It could fail because the memory limit is exceeed,
# but not in this case since we limit the recursion.