diff options
author | Jarno Mäkipää <jmakip87@gmail.com> | 2020-02-01 11:03:38 +0200 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-02-02 09:32:01 -0600 |
commit | df19a448f6e05f73dddabcf6f6da142cedccbbd6 (patch) | |
tree | eb17a232a63e54eb83f9dac6171f92e79d94dcc4 /tests | |
parent | 763e85820b91f11cac8930a6613b6da334755830 (diff) | |
download | toybox-df19a448f6e05f73dddabcf6f6da142cedccbbd6.tar.gz |
vi: fix dw_last test, add more tests
Fixed delete last word test. (script should not have \n since it is
cursor down in vim)
Added tests to check inserts
Added tests to check yank and push
Diffstat (limited to 'tests')
-rw-r--r-- | tests/files/vi/ascii_dw_last.out | 2 | ||||
-rw-r--r-- | tests/files/vi/ascii_insert_after_w.out | 4 | ||||
-rw-r--r-- | tests/files/vi/ascii_insert_eof.out | 4 | ||||
-rw-r--r-- | tests/files/vi/ascii_insert_multi.out | 4 | ||||
-rw-r--r-- | tests/files/vi/ascii_insert_multi_yy_push.out | 5 | ||||
-rw-r--r-- | tests/files/vi/ascii_insert_sof.out | 4 | ||||
-rw-r--r-- | tests/files/vi/ascii_yw_push.out | 4 | ||||
-rw-r--r-- | tests/files/vi/dw_last.in | 5 | ||||
-rw-r--r-- | tests/files/vi/insert_after_w.in | 2 | ||||
-rw-r--r-- | tests/files/vi/insert_eof.in | 2 | ||||
-rw-r--r-- | tests/files/vi/insert_multi.in | 2 | ||||
-rw-r--r-- | tests/files/vi/insert_multi_yy_push.in | 2 | ||||
-rw-r--r-- | tests/files/vi/insert_sof.in | 2 | ||||
-rw-r--r-- | tests/files/vi/yw_push.in | 3 | ||||
-rw-r--r-- | tests/vi.test | 108 |
15 files changed, 126 insertions, 27 deletions
diff --git a/tests/files/vi/ascii_dw_last.out b/tests/files/vi/ascii_dw_last.out index ee9f73ba..7a965051 100644 --- a/tests/files/vi/ascii_dw_last.out +++ b/tests/files/vi/ascii_dw_last.out @@ -1,4 +1,4 @@ abc def hij klm nop qrs -tuv wxy z +tuv wxy diff --git a/tests/files/vi/ascii_insert_after_w.out b/tests/files/vi/ascii_insert_after_w.out new file mode 100644 index 00000000..88886fc7 --- /dev/null +++ b/tests/files/vi/ascii_insert_after_w.out @@ -0,0 +1,4 @@ +abc hellodef hij +klm nop qrs +tuv wxy z + diff --git a/tests/files/vi/ascii_insert_eof.out b/tests/files/vi/ascii_insert_eof.out new file mode 100644 index 00000000..deb55c1d --- /dev/null +++ b/tests/files/vi/ascii_insert_eof.out @@ -0,0 +1,4 @@ +abc def hij +klm nop qrs +tuv wxy z +hello diff --git a/tests/files/vi/ascii_insert_multi.out b/tests/files/vi/ascii_insert_multi.out new file mode 100644 index 00000000..85591656 --- /dev/null +++ b/tests/files/vi/ascii_insert_multi.out @@ -0,0 +1,4 @@ +abcdef abc def hij +klm nop qrs +tuv wxy z + diff --git a/tests/files/vi/ascii_insert_multi_yy_push.out b/tests/files/vi/ascii_insert_multi_yy_push.out new file mode 100644 index 00000000..6e01b0b2 --- /dev/null +++ b/tests/files/vi/ascii_insert_multi_yy_push.out @@ -0,0 +1,5 @@ +abcdef abc def hij +klm nop qrs +abcdef abc def hij +tuv wxy z + diff --git a/tests/files/vi/ascii_insert_sof.out b/tests/files/vi/ascii_insert_sof.out new file mode 100644 index 00000000..9eca6509 --- /dev/null +++ b/tests/files/vi/ascii_insert_sof.out @@ -0,0 +1,4 @@ +helloabc def hij +klm nop qrs +tuv wxy z + diff --git a/tests/files/vi/ascii_yw_push.out b/tests/files/vi/ascii_yw_push.out new file mode 100644 index 00000000..435531a6 --- /dev/null +++ b/tests/files/vi/ascii_yw_push.out @@ -0,0 +1,4 @@ +abc def hijdef +klm nop qrs +tuv wxy z + diff --git a/tests/files/vi/dw_last.in b/tests/files/vi/dw_last.in index dc69492f..76495036 100644 --- a/tests/files/vi/dw_last.in +++ b/tests/files/vi/dw_last.in @@ -1,6 +1,3 @@ -G -$ -b -dw +G$bdw :wq diff --git a/tests/files/vi/insert_after_w.in b/tests/files/vi/insert_after_w.in new file mode 100644 index 00000000..232b631e --- /dev/null +++ b/tests/files/vi/insert_after_w.in @@ -0,0 +1,2 @@ +wihello +:wq diff --git a/tests/files/vi/insert_eof.in b/tests/files/vi/insert_eof.in new file mode 100644 index 00000000..b2e18d3c --- /dev/null +++ b/tests/files/vi/insert_eof.in @@ -0,0 +1,2 @@ +G$ihello +:wq diff --git a/tests/files/vi/insert_multi.in b/tests/files/vi/insert_multi.in new file mode 100644 index 00000000..cd6a4239 --- /dev/null +++ b/tests/files/vi/insert_multi.in @@ -0,0 +1,2 @@ +iab icd ief :wq + diff --git a/tests/files/vi/insert_multi_yy_push.in b/tests/files/vi/insert_multi_yy_push.in new file mode 100644 index 00000000..65134bd8 --- /dev/null +++ b/tests/files/vi/insert_multi_yy_push.in @@ -0,0 +1,2 @@ +iab icd ief yyjp:wq + diff --git a/tests/files/vi/insert_sof.in b/tests/files/vi/insert_sof.in new file mode 100644 index 00000000..b91b2c1b --- /dev/null +++ b/tests/files/vi/insert_sof.in @@ -0,0 +1,2 @@ +ihello +:wq diff --git a/tests/files/vi/yw_push.in b/tests/files/vi/yw_push.in new file mode 100644 index 00000000..a653ec32 --- /dev/null +++ b/tests/files/vi/yw_push.in @@ -0,0 +1,3 @@ +wyw2ep +:wq + diff --git a/tests/vi.test b/tests/vi.test index 1c6ff241..4e84ea4c 100644 --- a/tests/vi.test +++ b/tests/vi.test @@ -7,11 +7,10 @@ cp $FILES/vi/ascii.txt in.txt cp $FILES/vi/dd_first.in cmd.txt cp $FILES/vi/ascii_dd_first.out out.txt - -testing "dd first line ascii" \ +toyonly testing "dd first line ascii" \ "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" -# teardown +# teardown rm in.txt cmd.txt out.txt # setup @@ -19,45 +18,43 @@ cp $FILES/vi/ascii.txt in.txt cp $FILES/vi/dd_last.in cmd.txt cp $FILES/vi/ascii_dd_last.out out.txt -testing "dd last line ascii" \ +toyonly testing "dd last line ascii" \ "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" -# teardown +# teardown rm in.txt cmd.txt out.txt +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/dw_last.in cmd.txt +cp $FILES/vi/ascii_dw_last.out out.txt -## setup -#cp $FILES/vi/ascii.txt in.txt -#cp $FILES/vi/dw_last.in cmd.txt -#cp $FILES/vi/ascii_dw_last.out out.txt -# -#testing "dw last line ascii" \ -# "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" -# -## teardown -#rm in.txt cmd.txt out.txt +toyonly testing "dw last line ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt # setup cp $FILES/vi/ascii.txt in.txt cp $FILES/vi/dw_first.in cmd.txt cp $FILES/vi/ascii_dw_first.out out.txt -testing "dw first line ascii" \ +toyonly testing "dw first line ascii" \ "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" -# teardown +# teardown rm in.txt cmd.txt out.txt - # setup cp $FILES/vi/ascii.txt in.txt cp $FILES/vi/D_first.in cmd.txt cp $FILES/vi/ascii_D_first.out out.txt -testing "D first line ascii" \ +toyonly testing "D first line ascii" \ "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" -# teardown +# teardown rm in.txt cmd.txt out.txt # setup @@ -65,8 +62,75 @@ cp $FILES/vi/ascii.txt in.txt cp $FILES/vi/D_last.in cmd.txt cp $FILES/vi/ascii_D_last.out out.txt -testing "D last line ascii" \ +toyonly testing "D last line ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt + +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/yw_push.in cmd.txt +cp $FILES/vi/ascii_yw_push.out out.txt + +toyonly testing "yw push ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt + +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/insert_sof.in cmd.txt +cp $FILES/vi/ascii_insert_sof.out out.txt + +toyonly testing "insert start of file ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt + +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/insert_eof.in cmd.txt +cp $FILES/vi/ascii_insert_eof.out out.txt + +toyonly testing "insert end of file ascii" \ "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" -# teardown +# teardown rm in.txt cmd.txt out.txt + +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/insert_after_w.in cmd.txt +cp $FILES/vi/ascii_insert_after_w.out out.txt + +toyonly testing "insert after first word ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt + +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/insert_multi.in cmd.txt +cp $FILES/vi/ascii_insert_multi.out out.txt + +toyonly testing "insert multiple times ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt + +# setup +cp $FILES/vi/ascii.txt in.txt +cp $FILES/vi/insert_multi_yy_push.in cmd.txt +cp $FILES/vi/ascii_insert_multi_yy_push.out out.txt + +toyonly testing "insert multi yank move and push ascii" \ + "vi -s cmd.txt in.txt 1>/dev/null 2>/dev/null && cmp in.txt out.txt && echo yes" "yes\n" "" "" + +# teardown +rm in.txt cmd.txt out.txt + |