From cc0f8e94fed7fa2542d746361acdbfe76401a93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 7 Feb 2017 11:26:12 +0100 Subject: test: add a few new tests related to text objects --- vis/text-objects/entire.in | 8 ++++++++ vis/text-objects/entire.keys | 1 + vis/text-objects/entire.ref | 8 ++++++++ vis/text-objects/functions.in | 26 ++++++++++++++++++++++++++ vis/text-objects/functions.keys | 9 +++++++++ vis/text-objects/functions.ref | 12 ++++++++++++ vis/text-objects/indentation.in | 16 ++++++++++++++++ vis/text-objects/indentation.keys | 4 ++++ vis/text-objects/indentation.ref | 16 ++++++++++++++++ vis/text-objects/line.in | 6 ++++++ vis/text-objects/line.keys | 9 +++++++++ vis/text-objects/line.ref | 2 ++ vis/text-objects/search-result.in | 8 ++++++++ vis/text-objects/search-result.keys | 8 ++++++++ vis/text-objects/search-result.ref | 8 ++++++++ 15 files changed, 141 insertions(+) create mode 100644 vis/text-objects/entire.in create mode 100644 vis/text-objects/entire.keys create mode 100644 vis/text-objects/entire.ref create mode 100644 vis/text-objects/functions.in create mode 100644 vis/text-objects/functions.keys create mode 100644 vis/text-objects/functions.ref create mode 100644 vis/text-objects/indentation.in create mode 100644 vis/text-objects/indentation.keys create mode 100644 vis/text-objects/indentation.ref create mode 100644 vis/text-objects/line.in create mode 100644 vis/text-objects/line.keys create mode 100644 vis/text-objects/line.ref create mode 100644 vis/text-objects/search-result.in create mode 100644 vis/text-objects/search-result.keys create mode 100644 vis/text-objects/search-result.ref (limited to 'vis') diff --git a/vis/text-objects/entire.in b/vis/text-objects/entire.in new file mode 100644 index 0000000..31af792 --- /dev/null +++ b/vis/text-objects/entire.in @@ -0,0 +1,8 @@ + + Heading + ------- + + 1. first + + 2. second + diff --git a/vis/text-objects/entire.keys b/vis/text-objects/entire.keys new file mode 100644 index 0000000..10013ad --- /dev/null +++ b/vis/text-objects/entire.keys @@ -0,0 +1 @@ +>ie diff --git a/vis/text-objects/entire.ref b/vis/text-objects/entire.ref new file mode 100644 index 0000000..7674f68 --- /dev/null +++ b/vis/text-objects/entire.ref @@ -0,0 +1,8 @@ + + Heading + ------- + + 1. first + + 2. second + diff --git a/vis/text-objects/functions.in b/vis/text-objects/functions.in new file mode 100644 index 0000000..5179cb2 --- /dev/null +++ b/vis/text-objects/functions.in @@ -0,0 +1,26 @@ +static double pi = 3.14; + +/* addition */ +int add(int a, int b) { + return a+b; +} + +static double e = 2.71; + +/* multiplication of + * + * a*b + */ +int mul(int a, int b) +{ + return a*b; +} + +static double sqrt2 = 1.41; + +int +div(int a, int b) +{ + return a/b; +} + diff --git a/vis/text-objects/functions.keys b/vis/text-objects/functions.keys new file mode 100644 index 0000000..32c5a70 --- /dev/null +++ b/vis/text-objects/functions.keys @@ -0,0 +1,9 @@ +]] +daf +O// add +]] +daf +O// mul +]] +daf +O// div diff --git a/vis/text-objects/functions.ref b/vis/text-objects/functions.ref new file mode 100644 index 0000000..0b3ce0f --- /dev/null +++ b/vis/text-objects/functions.ref @@ -0,0 +1,12 @@ +static double pi = 3.14; + +// add + +static double e = 2.71; + +// mul + +static double sqrt2 = 1.41; + +// div + diff --git a/vis/text-objects/indentation.in b/vis/text-objects/indentation.in new file mode 100644 index 0000000..8ab6759 --- /dev/null +++ b/vis/text-objects/indentation.in @@ -0,0 +1,16 @@ +static ssize_t write_all(int fd, const char *buf, size_t count) { + size_t rem = count; + while (rem > 0) { + ssize_t written = write(fd, buf, rem); + if (written < 0) { + if (errno == EAGAIN || errno == EINTR) + continue; + return -1; + } else if (written == 0) { + break; + } + rem -= written; + buf += written; + } + return count - rem; +} diff --git a/vis/text-objects/indentation.keys b/vis/text-objects/indentation.keys new file mode 100644 index 0000000..75c612d --- /dev/null +++ b/vis/text-objects/indentation.keys @@ -0,0 +1,4 @@ +/continue +3vi +:x/^/ c/\/\/ + diff --git a/vis/text-objects/indentation.ref b/vis/text-objects/indentation.ref new file mode 100644 index 0000000..ad35e8e --- /dev/null +++ b/vis/text-objects/indentation.ref @@ -0,0 +1,16 @@ +static ssize_t write_all(int fd, const char *buf, size_t count) { + size_t rem = count; + while (rem > 0) { +// ssize_t written = write(fd, buf, rem); +// if (written < 0) { +// if (errno == EAGAIN || errno == EINTR) +// continue; +// return -1; +// } else if (written == 0) { +// break; +// } +// rem -= written; +// buf += written; + } + return count - rem; +} diff --git a/vis/text-objects/line.in b/vis/text-objects/line.in new file mode 100644 index 0000000..0c6acfa --- /dev/null +++ b/vis/text-objects/line.in @@ -0,0 +1,6 @@ +normal line + normal line with white space +normal line + normal line with white space +inner line + inner line with white space diff --git a/vis/text-objects/line.keys b/vis/text-objects/line.keys new file mode 100644 index 0000000..0c3ee72 --- /dev/null +++ b/vis/text-objects/line.keys @@ -0,0 +1,9 @@ +dal +. +2. +cil>was an inner line< +. +j +. +g0i| +$. diff --git a/vis/text-objects/line.ref b/vis/text-objects/line.ref new file mode 100644 index 0000000..4a8cc7b --- /dev/null +++ b/vis/text-objects/line.ref @@ -0,0 +1,2 @@ +>was an inner line< +| >was an inner line< | diff --git a/vis/text-objects/search-result.in b/vis/text-objects/search-result.in new file mode 100644 index 0000000..44421e4 --- /dev/null +++ b/vis/text-objects/search-result.in @@ -0,0 +1,8 @@ +// add static using gn +void f1(void); +void f2(void); +void f3(void); +// add static using gN +void f4(void); +void f5(void); +void f6(void); diff --git a/vis/text-objects/search-result.keys b/vis/text-objects/search-result.keys new file mode 100644 index 0000000..051b4e2 --- /dev/null +++ b/vis/text-objects/search-result.keys @@ -0,0 +1,8 @@ +/void +cgnstatic void +2. +. +G$ +c2gNstatic void +3. +. diff --git a/vis/text-objects/search-result.ref b/vis/text-objects/search-result.ref new file mode 100644 index 0000000..3713c1c --- /dev/null +++ b/vis/text-objects/search-result.ref @@ -0,0 +1,8 @@ +// add static using gn +static void f1(void); +static void f2(void); +static void f3(void); +// add static using gN +static void f4(void); +static void f5(void); +static void f6(void); -- cgit v1.2.3