aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/fixtures/shell-test.c23
-rw-r--r--test/functional/ui/output_spec.lua25
2 files changed, 48 insertions, 0 deletions
diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c
index 8dbec2aaee..38695ce76b 100644
--- a/test/functional/fixtures/shell-test.c
+++ b/test/functional/fixtures/shell-test.c
@@ -4,6 +4,13 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
+#include <unistd.h>
+
+static void wait(void)
+{
+ fflush(stdout);
+ usleep(10*1000);
+}
static void help(void)
{
@@ -61,6 +68,22 @@ int main(int argc, char **argv)
for (uint8_t i = 0; i < number; i++) {
printf("%d: %s\n", (int) i, argv[3]);
}
+ } else if (strcmp(argv[1], "UTF-8") == 0) {
+ // test split-up UTF-8 sequence
+ printf("\xc3"); wait();
+ printf("\xa5\n"); wait();
+
+ // split up a 2+2 grapheme clusters all possible ways
+ printf("ref: \xc3\xa5\xcc\xb2\n"); wait();
+
+ printf("1: \xc3"); wait();
+ printf("\xa5\xcc\xb2\n"); wait();
+
+ printf("2: \xc3\xa5"); wait();
+ printf("\xcc\xb2\n"); wait();
+
+ printf("3: \xc3\xa5\xcc"); wait();
+ printf("\xb2\n"); wait();
} else {
fprintf(stderr, "Unknown first argument\n");
return 3;
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 4e79c2e6cb..14f2091046 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -9,6 +9,7 @@ local feed_command = helpers.feed_command
local iswin = helpers.iswin
local clear = helpers.clear
local command = helpers.command
+local nvim_dir = helpers.nvim_dir
describe("shell command :!", function()
if helpers.pending_win32(pending) then return end
@@ -195,5 +196,29 @@ describe("shell command :!", function()
eq(true, screen.bell)
end)
end)
+
+ it('handles multibyte sequences split over buffer boundaries', function()
+ command('cd '..nvim_dir)
+ local cmd
+ if iswin() then
+ cmd = '!shell-test UTF-8 '
+ else
+ cmd = '!./shell-test UTF-8'
+ end
+ feed_command(cmd)
+ -- Note: only the first example of split composed char works
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ :]]..cmd..[[ |
+ å |
+ ref: å̲ |
+ 1: å̲ |
+ 2: å ̲ |
+ 3: å ̲ |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+ end)
end)
end)