vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit bee306ec0837e31d96eb405eab897e79c916610c
parent e57b03889fcf53c1e17260d00ffb089b3ce716e2
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue,  7 Feb 2017 11:26:12 +0100

test: add a few new tests related to text objects

Diffstat:
Avim/text-objects/words-count.in | 1+
Avim/text-objects/words-count.keys | 3+++
Rvim/text-objects/words.in -> vim/text-objects/words-eol.in | 0
Rvim/text-objects/words.keys -> vim/text-objects/words-eol.keys | 0
Avis/text-objects/entire.in | 8++++++++
Avis/text-objects/entire.keys | 1+
Avis/text-objects/entire.ref | 8++++++++
Avis/text-objects/functions.in | 26++++++++++++++++++++++++++
Avis/text-objects/functions.keys | 9+++++++++
Avis/text-objects/functions.ref | 12++++++++++++
Avis/text-objects/indentation.in | 16++++++++++++++++
Avis/text-objects/indentation.keys | 4++++
Avis/text-objects/indentation.ref | 16++++++++++++++++
Avis/text-objects/line.in | 6++++++
Avis/text-objects/line.keys | 9+++++++++
Avis/text-objects/line.ref | 2++
Avis/text-objects/search-result.in | 8++++++++
Avis/text-objects/search-result.keys | 8++++++++
Avis/text-objects/search-result.ref | 8++++++++
19 files changed, 145 insertions(+), 0 deletions(-)

diff --git a/vim/text-objects/words-count.in b/vim/text-objects/words-count.in @@ -0,0 +1 @@ +The brown fox jumps over the lazy dog. diff --git a/vim/text-objects/words-count.keys b/vim/text-objects/words-count.keys @@ -0,0 +1,3 @@ +3ciwchanged<Escape> +/fox<Enter> +5. diff --git a/vim/text-objects/words.in b/vim/text-objects/words-eol.in diff --git a/vim/text-objects/words.keys b/vim/text-objects/words-eol.keys diff --git a/vis/text-objects/entire.in 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 @@ -0,0 +1 @@ +>ie diff --git a/vis/text-objects/entire.ref 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 @@ -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 @@ -0,0 +1,9 @@ +]] +daf +O/<C-v>/ add<Escape> +]] +daf +O/<C-v>/ mul<Escape> +]] +daf +O/<C-v>/ div<Escape> diff --git a/vis/text-objects/functions.ref 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 @@ -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 @@ -0,0 +1,4 @@ +/continue<Enter> +3vi<Tab> +:x/^/ c/\/\/<Enter> +<Escape> diff --git a/vis/text-objects/indentation.ref 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 @@ -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 @@ -0,0 +1,9 @@ +dal +. +2. +cil>was an inner line<<Escape> +. +j +. +g0i|<Escape> +$. diff --git a/vis/text-objects/line.ref 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 @@ -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 @@ -0,0 +1,8 @@ +/void<Enter> +cgnstatic void<Escape> +2. +. +G$ +c2gNstatic void<Escape> +3. +. diff --git a/vis/text-objects/search-result.ref 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);