diff options
| author | b-r-o-c-k <brockmammen@gmail.com> | 2018-04-14 14:17:51 -0500 |
|---|---|---|
| committer | b-r-o-c-k <brockmammen@gmail.com> | 2018-04-14 14:17:51 -0500 |
| commit | ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f (patch) | |
| tree | 92de2079e80f5f289dd87a54af123cb7d90c3058 /test/functional/fixtures | |
| parent | 78bc52ea5397c092d01cd08296fe1dc85d998329 (diff) | |
| parent | ef4feab0e75be19c5f41d70a001db980b72090f5 (diff) | |
| download | rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.tar.gz rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.tar.bz2 rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.zip | |
Merge branch 'master' into s-dash-stdin
Diffstat (limited to 'test/functional/fixtures')
| -rw-r--r-- | test/functional/fixtures/shell-test.c | 28 | ||||
| -rw-r--r-- | test/functional/fixtures/shell_data.txt | bin | 0 -> 50 bytes | |||
| -rw-r--r-- | test/functional/fixtures/tty-test.c | 11 |
3 files changed, 38 insertions, 1 deletions
diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c index 8dbec2aaee..a744d5df46 100644 --- a/test/functional/fixtures/shell-test.c +++ b/test/functional/fixtures/shell-test.c @@ -4,6 +4,18 @@ #include <stdio.h> #include <string.h> #include <stdint.h> +#ifdef _MSC_VER +#include <Windows.h> +#define usleep(usecs) Sleep(usecs/1000) +#else +#include <unistd.h> +#endif + +static void wait(void) +{ + fflush(stdout); + usleep(10*1000); +} static void help(void) { @@ -61,6 +73,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/fixtures/shell_data.txt b/test/functional/fixtures/shell_data.txt Binary files differnew file mode 100644 index 0000000000..ef3506c5b1 --- /dev/null +++ b/test/functional/fixtures/shell_data.txt diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c index edcbe23f86..4f0858acdb 100644 --- a/test/functional/fixtures/tty-test.c +++ b/test/functional/fixtures/tty-test.c @@ -41,6 +41,7 @@ static void walk_cb(uv_handle_t *handle, void *arg) } } +#ifndef WIN32 static void sig_handler(int signum) { switch (signum) { @@ -57,6 +58,7 @@ static void sig_handler(int signum) return; } } +#endif #ifdef WIN32 static void sigwinch_cb(uv_signal_t *handle, int signum) @@ -94,7 +96,14 @@ static void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf) uv_tty_init(&write_loop, &out, fileno(stdout), 0); uv_write_t req; - uv_buf_t b = {.base = buf->base, .len = (size_t)cnt}; + uv_buf_t b = { + .base = buf->base, +#ifdef WIN32 + .len = (ULONG)cnt +#else + .len = (size_t)cnt +#endif + }; uv_write(&req, STRUCT_CAST(uv_stream_t, &out), &b, 1, NULL); uv_run(&write_loop, UV_RUN_DEFAULT); |