diff src/testdir/test_gn.vim @ 20199:a4bd28e2cf1d v8.2.0655

patch 8.2.0655: search code not sufficiently tested Commit: https://github.com/vim/vim/commit/224a5f17c6ec9e98322a4c6792ce4f9bb31a4cce Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 28 20:29:07 2020 +0200 patch 8.2.0655: search code not sufficiently tested Problem: Search code not sufficiently tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5999)
author Bram Moolenaar <Bram@vim.org>
date Tue, 28 Apr 2020 20:30:04 +0200
parents c0445cb7cfe0
children cbc570e66d11
line wrap: on
line diff
--- a/src/testdir/test_gn.vim
+++ b/src/testdir/test_gn.vim
@@ -154,8 +154,24 @@ func Test_gn_command()
   norm! gg0f2vf7gNd
   call assert_equal(['1678'], getline(1,'$'))
   sil! %d _
+  set wrapscan&vim
 
-  set wrapscan&vim
+  " Without 'wrapscan', in visual mode, running gn without a match should fail
+  " but the visual mode should be kept.
+  set nowrapscan
+  call setline('.', 'one two')
+  let @/ = 'one'
+  call assert_beeps('normal 0wvlgn')
+  exe "normal y"
+  call assert_equal('tw', @")
+
+  " with exclusive selection, run gn and gN
+  set selection=exclusive
+  normal 0gny
+  call assert_equal('one', @")
+  normal 0wgNy
+  call assert_equal('one', @")
+  set selection&
 endfu
 
 func Test_gn_multi_line()