changeset 15838:de068e9acd8e v8.1.0926

patch 8.1.0926: no test for :wnext, :wNext and :wprevious commit https://github.com/vim/vim/commit/e93e5a504f481bd0dad9c504d5fcf0e5f0dfc6e6 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 15 20:22:38 2019 +0100 patch 8.1.0926: no test for :wnext, :wNext and :wprevious Problem: No test for :wnext, :wNext and :wprevious. Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/3963)
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 Feb 2019 20:30:07 +0100
parents c209fe9007a1
children ed6ecf44dbaf
files src/testdir/Make_all.mak src/testdir/test_alot.vim src/testdir/test_wnext.vim src/version.c
diffstat 4 files changed, 105 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -269,6 +269,7 @@ NEW_TESTS = \
 	test_window_cmd \
 	test_window_id \
 	test_windows_home \
+	test_wnext \
 	test_wordcount \
 	test_writefile \
 	test_xxd \
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -66,3 +66,4 @@ source test_true_false.vim
 source test_unlet.vim
 source test_virtualedit.vim
 source test_window_cmd.vim
+source test_wnext.vim
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_wnext.vim
@@ -0,0 +1,101 @@
+" Test :wnext :wNext and :wprevious
+
+func Test_wnext()
+  args X1 X2
+
+  call setline(1, '1')
+  wnext
+  call assert_equal(['1'], readfile('X1'))
+  call assert_equal('X2', bufname('%'))
+
+  call setline(1, '2')
+  call assert_fails('wnext', 'E165:')
+  call assert_equal(['2'], readfile('X2'))
+  call assert_equal('X2', bufname('%'))
+
+  " Test :wnext with a single file.
+  args X1
+  call assert_equal('X1', bufname('%'))
+  call assert_fails('wnext', 'E163:')
+
+  " Test :wnext with a count.
+  args X1 X2 X3
+  call assert_equal('X1', bufname('%'))
+  2wnext
+  call assert_equal('X3', bufname('%'))
+
+  " Test :wnext {file}.
+  args X1 X2 X3
+  wnext X4
+  call assert_equal(['1'], readfile('X4'))
+  call assert_equal('X2', bufname('%'))
+  call assert_fails('wnext X4', 'E13:')
+  call assert_equal(['1'], readfile('X4'))
+  wnext! X4
+  call assert_equal(['2'], readfile('X4'))
+  call assert_equal('X3', bufname('%'))
+
+  args X1 X2
+  " Commented out as, E13 occurs on Windows instead of E17
+  "call assert_fails('wnext .', 'E17:')
+  call assert_fails('wnext! .', 'E502:')
+
+  %bwipe!
+  call delete('X1')
+  call delete('X2')
+  call delete('X3')
+  call delete('X4')
+endfunc
+
+func Test_wprevious()
+  args X1 X2
+
+  next
+  call assert_equal('X2', bufname('%'))
+  call setline(1, '2')
+  wprevious
+  call assert_equal(['2'], readfile('X2'))
+  call assert_equal('X1', bufname('%'))
+
+  call setline(1, '1')
+  call assert_fails('wprevious', 'E164:')
+  call assert_fails('wNext', 'E164:')
+
+  " Test :wprevious with a single file.
+  args X1
+  call assert_fails('wprevious', 'E163:')
+  call assert_fails('wNext', 'E163:')
+
+  " Test :wprevious with a count.
+  args X1 X2 X3
+  2next
+  call setline(1, '3')
+  call assert_equal('X3', bufname('%'))
+  2wprevious
+  call assert_equal('X1', bufname('%'))
+  call assert_equal(['3'], readfile('X3'))
+
+  " Test :wprevious {file}
+  args X1 X2 X3
+  2next
+  call assert_equal('X3', bufname('%'))
+  wprevious X4
+  call assert_equal(['3'], readfile('X4'))
+  call assert_equal('X2', bufname('%'))
+  call assert_fails('wprevious X4', 'E13:')
+  call assert_equal(['3'], readfile('X4'))
+  wprevious! X4
+  call assert_equal(['2'], readfile('X4'))
+  call assert_equal('X1', bufname('%'))
+
+  args X1 X2
+  " Commented out as, E13 occurs on Windows instead of E17
+  "call assert_fails('wprevious .', 'E17:')
+  call assert_fails('wprevious! .', 'E502:')
+
+  %bwipe!
+  call delete('X1')
+  call delete('X2')
+  call delete('X3')
+  call delete('X4')
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -784,6 +784,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    926,
+/**/
     925,
 /**/
     924,