diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-04-08 22:23:35 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-04-08 23:59:21 +0300 |
commit | 44307bd7998e5f1fc81d63d74edaf4756ddf5a47 (patch) | |
tree | 130c3afbb6e92f01dee5c0adbf58be2551d3db00 /tests/testsuite.at | |
parent | ed73342ba738a2f65bf916a10670bfeec137a562 (diff) | |
download | sciteco-44307bd7998e5f1fc81d63d74edaf4756ddf5a47.tar.gz |
improved rubbing out commands with modifiers
* This was actually broken if the command is preceded by `@` and `:` characters, which
are __not__ modifiers.
E.g. `Q:@I/foo^W` would have rubbed out the `:` register as well.
* Also, since it was all done in teco_state_process_edit_cmd(),
it would also rub out modifier characters from within string arguments,
E.g. `@I/::^EQ^W`
* Real commands now have their own ^W rubout implementation, while the generic
fallback just rubs out until the start state is re-established.
This fails to rub out modifiers as in `@I/^W`, though.
* Real command characters now use the common TECO_DEFINE_STATE_COMMAND().
* Added test cases for CTRL+W rub out.
A few control characters are now portably available to tests
via environment variables `$ESCAPE`, `$RUBOUT` and `$RUBOUT_WORD`.
Diffstat (limited to 'tests/testsuite.at')
-rw-r--r-- | tests/testsuite.at | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at index cb1fe61..20869f4 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -198,6 +198,23 @@ AT_CHECK([$SCITECO -e "@EC'dd if=/dev/zero bs=512 count=1' Z= Z-512\"N(0/0)'"], AT_CHECK([$SCITECO -e "0,128ED @EC'dd if=/dev/zero bs=512 count=1' Z= Z-512\"N(0/0)'"], 0, ignore, ignore) AT_CLEANUP +# +# Command-line editing. +# +# This either uses the portable $RUBOUT and $RUBOUT_WORD variables or +# we use the push/pop command-line commands { and } from start states. +# +# NOTE: Most errors are not reported in exit codes - you must check stderr. +# +AT_SETUP([Rub out with immediate editing commands]) +# Must rub out @, but not the colon from the Q-Reg specification. +AT_CHECK([$SCITECO_CMDLINE "Q:@I/XXX/ ${RUBOUT_WORD}{Z-2\"N(0/0)'}"], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) +# Should not rub out @ and : characters. +AT_CHECK([$SCITECO_CMDLINE "@I/ @:foo ${RUBOUT_WORD}/ Z-3\"N(0/0)'"], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) +AT_CLEANUP + AT_BANNER([Regression Tests]) AT_SETUP([Glob patterns with character classes]) @@ -293,12 +310,8 @@ AT_CHECK([$SCITECO_CMDLINE "!foo!{-5D}"], 0, ignore, stderr) AT_CLEANUP # -# Command-line editing bugs. -# -# NOTE: It would generally be possible to use control codes like ^H (8) -# and ^W (23) for rubout as well, but this is tricky to write in a portable manner. -# Therefore we usally use the push/pop command-line commands { and }. -# NOTE: Most errors are not reported in exit codes - you must check stderr. +# Command-line editing regressions: +# See above for rules. # AT_SETUP([Rub out string append]) AT_CHECK([$SCITECO_CMDLINE "@I/XXX/ H:Xa{-4D} :Qa-0\"N(0/0)'"], 0, ignore, stderr) @@ -364,3 +377,10 @@ AT_SETUP([Recursion overflow]) AT_CHECK([$SCITECO -e "@^Um{U.a Q.a-100000\"<%.aMm'} 0Mm"], 0, ignore, ignore) AT_XFAIL_IF(true) AT_CLEANUP + +AT_SETUP([Rub out from empty string argument]) +# Should rub out the modifiers as well. +AT_CHECK([$SCITECO_CMDLINE ":@^Ua/${RUBOUT_WORD}{Z\"N(0/0)'}"], 0, ignore, stderr) +AT_CHECK([$GREP "^Error:" stderr], 0, ignore ignore) +AT_XFAIL_IF(true) +AT_CLEANUP |