From 3fda29e44ee0c9ef2a0b81d91af568c7e1c35c1f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 23 May 2025 19:37:54 +0300 Subject: <^C> is a plain "return" command now, while <^C^C> exits from the program * This may break existing macros! ^C is now essentially a synonym for $$ and may not terminate the program when called from a non-toplevel macro frame. However it improves compatibility with TECO-11. * In contrast to TECO-11, ^C^C (exit) can be typed completely in upcaret mode. Otherwise it wouldn't have been possible to use the exit command in ASCII-only scripts. * The implementation of ^C^C uses a lookahead state similar to ^[ (escape). ^C does not return immediately, but the following character determines whether it will perform a return or exit. It's one of the rare cases in SciTECO where this is possible and safe since ^C is also disallowed on the command-line to avoid undesired command-line terminations after ^C interruptions. (You can only use $$ to terminate the command-line interactively.) --- tests/testsuite.at | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index 5cf3d4f..776fc41 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -6,7 +6,7 @@ AT_COLOR_TESTS AT_ARG_OPTION([valgrind], AS_HELP_STRING([--valgrind], [Run tests under Valgrind (memcheck)])) -# NOTE: We could use 1^C to get an unsuccessful return code. +# NOTE: We could use 1^C or 1^C^C to get an unsuccessful return code. # However, this won't print any stack trace or error message. # Therefore, we still use the idiom "(0/0)" to enforce a "Division by zero" # error whenever we want to fail. @@ -57,8 +57,9 @@ AT_CLEANUP AT_SETUP([Exit status]) TE_CHECK([[23]], 23, ignore, ignore) -TE_CHECK([[42^C]], 42, ignore, ignore) -TE_CHECK([[13$$]], 13, ignore, ignore) +TE_CHECK([[42^C (0/0)]], 42, ignore, ignore) +TE_CHECK([[13$$ (0/0)]], 13, ignore, ignore) +TE_CHECK([[@^Um{9^C^C} Mm (0/0)]], 9, ignore, ignore) AT_CLEANUP AT_SETUP([Radix]) @@ -280,9 +281,17 @@ TE_CHECK_CMDLINE([[@I/ @:foo ]]TE_RUBOUT_WORD[[/ Z-3"N(0/0)']], 0, ignore, stde AT_FAIL_IF([$GREP "^Error:" stderr]) AT_CLEANUP -AT_SETUP([Command-line termination while editing replacement register]) +AT_SETUP([Disallowed interactive commands]) +# Command-line termination while editing the replacement register would +# be hard to recover from. TE_CHECK_CMDLINE([[{$$}]], 0, ignore, stderr) AT_FAIL_IF([! $GREP "^Error:" stderr]) +# ^C interruption should not terminate the command-line accidentally. +TE_CHECK_CMDLINE([[^C]], 0, ignore, stderr) +AT_FAIL_IF([! $GREP "^Error:" stderr]) +# ^C^C is generally disallowed in interactive mode. +TE_CHECK_CMDLINE([[@^Um{^C^C} Mm]], 0, ignore, stderr) +AT_FAIL_IF([! $GREP "^Error:" stderr]) AT_CLEANUP AT_BANNER([Standard library]) -- cgit v1.2.3