ttest: include the test suite - neatvi - [fork] simple vi-type editor with UTF-8 support
(HTM) git clone git://src.adamsgaard.dk/neatvi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 505f0d068cdd0bb059a0d092a2f5fec6a1d7c763
(DIR) parent 24eedb0f1d1619ee2bdb5b47475a8dda4d241396
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Mon, 4 Oct 2021 17:17:00 +0330
ttest: include the test suite
Diffstat:
A test.sh | 15 +++++++++++++++
A test/e00.sh | 3 +++
A test/e01.sh | 9 +++++++++
A test/e02.sh | 12 ++++++++++++
A test/e03.sh | 14 ++++++++++++++
A test/e04.sh | 16 ++++++++++++++++
A test/e05.sh | 15 +++++++++++++++
A test/e06.sh | 18 ++++++++++++++++++
A test/e07.sh | 14 ++++++++++++++
A test/e08.sh | 13 +++++++++++++
A test/e09.sh | 12 ++++++++++++
A test/e0a.sh | 12 ++++++++++++
A test/e0b.sh | 18 ++++++++++++++++++
A test/e0c.sh | 24 ++++++++++++++++++++++++
A test/e0d.sh | 22 ++++++++++++++++++++++
A test/e0e.sh | 13 +++++++++++++
A test/e0f.sh | 13 +++++++++++++
A test/e10.sh | 13 +++++++++++++
A test/v00.sh | 10 ++++++++++
A test/v01.sh | 12 ++++++++++++
A test/v02.sh | 14 ++++++++++++++
A test/v03.sh | 10 ++++++++++
A test/v04.sh | 14 ++++++++++++++
A test/v05.sh | 11 +++++++++++
A test/v06.sh | 15 +++++++++++++++
A test/v07.sh | 14 ++++++++++++++
A test/v08.sh | 12 ++++++++++++
A test/v09.sh | 12 ++++++++++++
A test/v0a.sh | 14 ++++++++++++++
A test/v0b.sh | 16 ++++++++++++++++
A test/v0c.sh | 12 ++++++++++++
A test/v0d.sh | 11 +++++++++++
A test/v0e.sh | 15 +++++++++++++++
A test/v0f.sh | 13 +++++++++++++
A test/v10.sh | 17 +++++++++++++++++
A test/v11.sh | 15 +++++++++++++++
A test/v12.sh | 15 +++++++++++++++
A test/v13.sh | 18 ++++++++++++++++++
A test/v14.sh | 14 ++++++++++++++
A test/v15.sh | 13 +++++++++++++
A test/v16.sh | 14 ++++++++++++++
A test/v17.sh | 15 +++++++++++++++
A test/v18.sh | 10 ++++++++++
A test/v19.sh | 12 ++++++++++++
A test/v1a.sh | 12 ++++++++++++
A test/v1b.sh | 11 +++++++++++
A test/v1c.sh | 12 ++++++++++++
A test/v1d.sh | 10 ++++++++++
A test/v1e.sh | 12 ++++++++++++
A test/v1f.sh | 10 ++++++++++
A test/v20.sh | 11 +++++++++++
51 files changed, 682 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/test.sh b/test.sh
t@@ -0,0 +1,15 @@
+#!/bin/sh
+
+for x in test/e??.sh; do
+ rm -f /tmp/.neatvi[12]
+ sh $x /tmp/.neatvi2 2>/tmp/.neatvi1 | ./vi -s -e >/dev/null
+ cmp -s /tmp/.neatvi[12] || echo "Failed: $x"
+ cmp -s /tmp/.neatvi[12] || diff -u /tmp/.neatvi[12]
+done
+
+for x in test/v??.sh; do
+ rm -f /tmp/.neatvi[12]
+ sh $x /tmp/.neatvi2 2>/tmp/.neatvi1 | ./vi -v >/dev/null
+ cmp -s /tmp/.neatvi[12] || echo "Failed: $x"
+ cmp -s /tmp/.neatvi[12] || diff -u /tmp/.neatvi[12]
+done
(DIR) diff --git a/test/e00.sh b/test/e00.sh
t@@ -0,0 +1,3 @@
+# vi commands
+echo ":w $1"
+echo ":q"
(DIR) diff --git a/test/e01.sh b/test/e01.sh
t@@ -0,0 +1,9 @@
+# vi commands
+echo ":i"
+echo "abc def"
+echo "."
+echo ":w $1"
+echo ":q"
+
+# the expected output
+echo "abc def" >&2
(DIR) diff --git a/test/e02.sh b/test/e02.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc def"
+echo "ghi jkl"
+echo "."
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc def" >&2
+echo "ghi jkl" >&2
(DIR) diff --git a/test/e03.sh b/test/e03.sh
t@@ -0,0 +1,14 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc"
+echo "."
+echo ":a"
+echo "def"
+echo "."
+echo ":undo"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
(DIR) diff --git a/test/e04.sh b/test/e04.sh
t@@ -0,0 +1,16 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc def"
+echo "."
+echo ":a"
+echo "ghi jkl"
+echo "."
+echo ":undo"
+echo ":redo"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc def" >&2
+echo "ghi jkl" >&2
(DIR) diff --git a/test/e05.sh b/test/e05.sh
t@@ -0,0 +1,15 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc"
+echo "def"
+echo "ghi"
+echo "."
+echo ":2ka"
+echo ":'ad"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
+echo "ghi" >&2
(DIR) diff --git a/test/e06.sh b/test/e06.sh
t@@ -0,0 +1,18 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc"
+echo "def"
+echo "ghi"
+echo "."
+echo ":1,2yank"
+echo ":1put"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
+echo "abc" >&2
+echo "def" >&2
+echo "def" >&2
+echo "ghi" >&2
(DIR) diff --git a/test/e07.sh b/test/e07.sh
t@@ -0,0 +1,14 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "<< >> << >>"
+echo "<< >> << >>"
+echo "."
+echo ":%s/<</left {/g"
+echo ":%s/>>/right }/g"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "left { right } left { right }" >&2
+echo "left { right } left { right }" >&2
(DIR) diff --git a/test/e08.sh b/test/e08.sh
t@@ -0,0 +1,13 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc"
+echo "axy"
+echo "."
+echo ':%s/a(..)/\\1a/g'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "bca" >&2
+echo "xya" >&2
(DIR) diff --git a/test/e09.sh b/test/e09.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo "e $1"
+echo "a"
+echo "abc"
+echo "def"
+echo "ghi"
+echo "."
+echo "%g/def/-1,/ghi/d"
+echo "wq"
+
+# the expected output
+echo -n "" >&2
(DIR) diff --git a/test/e0a.sh b/test/e0a.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo "e $1"
+echo "a"
+echo "abc"
+echo "def"
+echo "ghi"
+echo "."
+echo "%g/./d"
+echo "wq"
+
+# the expected output
+echo -n "" >&2
(DIR) diff --git a/test/e0b.sh b/test/e0b.sh
t@@ -0,0 +1,18 @@
+# vi commands
+echo "e $1"
+echo "a"
+echo "1"
+echo "2"
+echo "3"
+echo "4"
+echo "5"
+echo "."
+echo "1,4g/./+1s/$/x/"
+echo "wq"
+
+# the expected output
+echo "1" >&2
+echo "2x" >&2
+echo "3x" >&2
+echo "4x" >&2
+echo "5x" >&2
(DIR) diff --git a/test/e0c.sh b/test/e0c.sh
t@@ -0,0 +1,24 @@
+# vi commands
+echo "e $1"
+echo "a"
+echo "x"
+echo "1"
+echo "2"
+echo "3"
+echo "4"
+echo "5"
+echo "."
+echo "1d"
+echo "1,4g/./+1put"
+echo "wq"
+
+# the expected output
+echo "1" >&2
+echo "2" >&2
+echo "x" >&2
+echo "x" >&2
+echo "3" >&2
+echo "4" >&2
+echo "x" >&2
+echo "x" >&2
+echo "5" >&2
(DIR) diff --git a/test/e0d.sh b/test/e0d.sh
t@@ -0,0 +1,22 @@
+# vi commands
+echo "e $1"
+echo "a"
+echo "1"
+echo "2"
+echo "x"
+echo "3"
+echo "4"
+echo "x"
+echo "5"
+echo "."
+echo '%g/^x$/d|-2put'
+echo "wq"
+
+# the expected output
+echo "1" >&2
+echo "x" >&2
+echo "2" >&2
+echo "3" >&2
+echo "x" >&2
+echo "4" >&2
+echo "5" >&2
(DIR) diff --git a/test/e0e.sh b/test/e0e.sh
t@@ -0,0 +1,13 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc"
+echo "def"
+echo "."
+echo ':%s/(b.*)$/(\\1)/g'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "a(bc)" >&2
+echo "def" >&2
(DIR) diff --git a/test/e0f.sh b/test/e0f.sh
t@@ -0,0 +1,13 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "ab "
+echo " e "
+echo "."
+echo ':%s/ *$//g'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "ab" >&2
+echo " e" >&2
(DIR) diff --git a/test/e10.sh b/test/e10.sh
t@@ -0,0 +1,13 @@
+# vi commands
+echo ":e $1"
+echo ":a"
+echo "abc"
+echo "def"
+echo "."
+echo ':%s/(abc|def)/xyz/'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "xyz" >&2
+echo "xyz" >&2
(DIR) diff --git a/test/v00.sh b/test/v00.sh
t@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
(DIR) diff --git a/test/v01.sh b/test/v01.sh
t@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "hhA def"
+echo -n "Ighi "
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "ghi abc def" >&2
(DIR) diff --git a/test/v02.sh b/test/v02.sh
t@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "oghi jkl"
+echo -n "kOmno pqr"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "mno pqr" >&2
+echo "abc def" >&2
+echo "ghi jkl" >&2
(DIR) diff --git a/test/v03.sh b/test/v03.sh
t@@ -0,0 +1,10 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "0dB"
+echo -n "d0"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc def" >&2
(DIR) diff --git a/test/v04.sh b/test/v04.sh
t@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# vi commands
+echo ":e $1"
+echo "iabc def"
+echo -n "ghi jkl"
+echo -n "1Gf cE 123"
+echo -n "2Gf cB456"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc 123" >&2
+echo "456 jkl" >&2
(DIR) diff --git a/test/v05.sh b/test/v05.sh
t@@ -0,0 +1,11 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "oghi jkl"
+echo -n '1G$d$'
+echo -n '2GdB'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc ghi jkl" >&2
(DIR) diff --git a/test/v06.sh b/test/v06.sh
t@@ -0,0 +1,15 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "oghi jkl"
+echo -n "omno pqr"
+echo -n '1Gf d^$'
+echo -n '+dfi'
+echo -n '+f d$'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo " def" >&2
+echo " jkl" >&2
+echo "mno" >&2
(DIR) diff --git a/test/v07.sh b/test/v07.sh
t@@ -0,0 +1,14 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n '1Gyy'
+echo -n 'pGp'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
+echo "abc" >&2
+echo "def" >&2
+echo "abc" >&2
(DIR) diff --git a/test/v08.sh b/test/v08.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n 'dd'
+echo -n 'P'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "def" >&2
+echo "abc" >&2
(DIR) diff --git a/test/v09.sh b/test/v09.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "oghi jkl"
+echo -n 'F yeP'
+echo -n 'k$p'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc def jkl" >&2
+echo "ghi jkl jkl" >&2
(DIR) diff --git a/test/v0a.sh b/test/v0a.sh
t@@ -0,0 +1,14 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "o"
+echo -n "odef "
+echo -n "oghi."
+echo -n "ojkl"
+echo -n '1G5J'
+echo -n "i^"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc def ghi.^ jkl" >&2
(DIR) diff --git a/test/v0b.sh b/test/v0b.sh
t@@ -0,0 +1,16 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n "oghi"
+echo "?abc"
+echo -n "i1"
+echo "/ghi"
+echo -n "i2"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "1abc" >&2
+echo "def" >&2
+echo "2ghi" >&2
(DIR) diff --git a/test/v0c.sh b/test/v0c.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def ghi"
+echo "?abc"
+echo -n "i1"
+echo "/ghi"
+echo -n "i2"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "1abc def 2ghi" >&2
(DIR) diff --git a/test/v0d.sh b/test/v0d.sh
t@@ -0,0 +1,11 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "oghi jkl"
+echo -n "omno pqr"
+echo "1Gd/jkl/0"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "mno pqr" >&2
(DIR) diff --git a/test/v0e.sh b/test/v0e.sh
t@@ -0,0 +1,15 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc def"
+echo -n "oghi jkl"
+echo -n "omno pqr"
+echo -n "1Gr1"
+echo -n "2Gfh2r2"
+echo -n "3Gfp4r3"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "1bc def" >&2
+echo "g22 jkl" >&2
+echo "mno pqr" >&2
(DIR) diff --git a/test/v0f.sh b/test/v0f.sh
t@@ -0,0 +1,13 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n "1Gfxr1"
+echo -n "dfx"
+echo "d/xyz/"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "1bc" >&2
+echo "def" >&2
(DIR) diff --git a/test/v10.sh b/test/v10.sh
t@@ -0,0 +1,17 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n "oghi"
+echo -n '"add'
+echo -n 'dd'
+echo -n '"bdd'
+echo -n 'P"ap"bp'
+echo ':4d'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "def" >&2
+echo "ghi" >&2
+echo "abc" >&2
(DIR) diff --git a/test/v11.sh b/test/v11.sh
t@@ -0,0 +1,15 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n "oghi"
+echo "!krev"
+sleep .1
+echo ""
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
+echo "fed" >&2
+echo "ihg" >&2
(DIR) diff --git a/test/v12.sh b/test/v12.sh
t@@ -0,0 +1,15 @@
+# vi commands
+echo ":e $1"
+echo -n "ia"
+echo -n "oab"
+echo -n "oabc"
+echo -n '0kklllji1'
+echo -n 'kllji2'
+echo -n '$jx'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "a" >&2
+echo "21ab" >&2
+echo "ab" >&2
(DIR) diff --git a/test/v13.sh b/test/v13.sh
t@@ -0,0 +1,18 @@
+# vi commands
+echo ":e $1"
+echo ":set ic"
+echo -n "iABC"
+echo -n "oDEF"
+echo -n "oGHI"
+echo '1G/def'
+echo -n 'i1'
+echo ":set noic"
+echo '/ghi'
+echo -n 'i2'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "ABC" >&2
+echo "21DEF" >&2
+echo "GHI" >&2
(DIR) diff --git a/test/v14.sh b/test/v14.sh
t@@ -0,0 +1,14 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n "oghi"
+echo -n '1GA123'
+echo 'j.j.'
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc123" >&2
+echo "def123" >&2
+echo "ghi123" >&2
(DIR) diff --git a/test/v15.sh b/test/v15.sh
t@@ -0,0 +1,13 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc"
+echo -n "odef"
+echo -n "oabc"
+echo ":%s/abc/ghi/"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "ghi" >&2
+echo "def" >&2
+echo "ghi" >&2
(DIR) diff --git a/test/v16.sh b/test/v16.sh
t@@ -0,0 +1,14 @@
+# vi commands
+echo ":e $1"
+echo -n "iabc abc abc"
+echo -n "oabc abc abc"
+echo -n "oabc abc abc"
+echo ":2,3s/abc/111/"
+echo ":%s/abc/222/g"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "222 222 222" >&2
+echo "111 222 222" >&2
+echo "111 222 222" >&2
(DIR) diff --git a/test/v17.sh b/test/v17.sh
t@@ -0,0 +1,15 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo "/^/"
+echo "NxnP/$/"
+echo "xNp"
+echo ":w"
+echo ":q"
+
+# the expected output
+echo "abc" >&2
+echo "efi" >&2
+echo "dgh" >&2
(DIR) diff --git a/test/v18.sh b/test/v18.sh
t@@ -0,0 +1,10 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "o"
+echo "Adef"
+echo ":wq"
+
+# the expected output
+echo "abc" >&2
+echo "def" >&2
(DIR) diff --git a/test/v19.sh b/test/v19.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo ":set ai"
+echo "iabc"
+echo ""
+echo "def"
+echo ":wq"
+
+# the expected output
+echo " abc" >&2
+echo "" >&2
+echo " def" >&2
(DIR) diff --git a/test/v1a.sh b/test/v1a.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo -n "1G''x"
+echo ":wq"
+
+# the expected output
+echo "abc" >&2
+echo "def" >&2
+echo "hi" >&2
(DIR) diff --git a/test/v1b.sh b/test/v1b.sh
t@@ -0,0 +1,11 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo ":%g/def/d"
+echo ":wq"
+
+# the expected output
+echo "abc" >&2
+echo "ghi" >&2
(DIR) diff --git a/test/v1c.sh b/test/v1c.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo ":%g/^[dg]/s/h/x/"
+echo ":wq"
+
+# the expected output
+echo "abc" >&2
+echo "def" >&2
+echo "gxi" >&2
(DIR) diff --git a/test/v1d.sh b/test/v1d.sh
t@@ -0,0 +1,10 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo ":%g!/def/d"
+echo ":wq"
+
+# the expected output
+echo "def" >&2
(DIR) diff --git a/test/v1e.sh b/test/v1e.sh
t@@ -0,0 +1,12 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo -n "1G"
+echo ":/ghi/d"
+echo ":wq"
+
+# the expected output
+echo "abc" >&2
+echo "def" >&2
(DIR) diff --git a/test/v1f.sh b/test/v1f.sh
t@@ -0,0 +1,10 @@
+# vi commands
+echo ":e $1"
+echo "iabc"
+echo "odef"
+echo "oghi"
+echo ":g/[ah]/d"
+echo ":wq"
+
+# the expected output
+echo "def" >&2
(DIR) diff --git a/test/v20.sh b/test/v20.sh
t@@ -0,0 +1,11 @@
+# vi commands
+echo ":e $1"
+echo "iaa"
+echo "oab"
+echo "obb"
+echo ":g/a/.g/b/d"
+echo ":wq"
+
+# the expected output
+echo "aa" >&2
+echo "bb" >&2