From 8fbd0b3ff42ae10c3735801ad17f5345fdc77766 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 19 Sep 2024 03:05:15 +0200 Subject: "special" Q-Registers now support EQq/.../ (load) and E%q/.../ (save) commands * @EQ$/.../ sets the current directory from the contents of the given file. @E%$/.../ stores the currend directory in the given file. * @EQ*/.../ will fail, just like ^U*...$. @E%*/.../ stores the current buffer's name in the given file. * It's especially useful with the clipboard registers. There could still be a minor bug in @E%~/.../ with regard to EOL normalization as teco_view_save() will use the EOL style of the current document, which may not be the style of the Q-Reg contents. Conversions can generally be avoided for these particular commands. But without teco_view_save() we'd have to care about save point creation. --- tests/testsuite.at | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index 648e76c..fa14140 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -84,6 +84,22 @@ 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([echo -n ".." >loadqreg.txt], 0, ignore, ignore) +AT_CHECK([$SCITECO -e "@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/'], 0, ignore, ignore) +AT_CHECK([test "`cat saveqreg.txt`" = test], 0, ignore, ignore) +# The result of E%$ should always have forward slashes, +# so this check will work on Win32 as well. +AT_CHECK([$SCITECO -e '@E%$/saveqreg.txt/'], 0, ignore, ignore) +AT_CHECK([test "`cat saveqreg.txt`" = "$PWD"], 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) -- cgit v1.2.3