diff src/testdir/test_search.vim @ 19435:8f8a5a15d00a v8.2.0275

patch 8.2.0275: some Ex code not covered by tests Commit: https://github.com/vim/vim/commit/406cd90f1963ca60813db91c413eef4b1b78ee44 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 18 21:54:41 2020 +0100 patch 8.2.0275: some Ex code not covered by tests Problem: Some Ex code not covered by tests. Solution: Add test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5659)
author Bram Moolenaar <Bram@vim.org>
date Tue, 18 Feb 2020 22:00:04 +0100
parents 02111977dd05
children 5512aa74cb62
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1515,4 +1515,31 @@ func Test_search_tilde_pat()
   call delete('Xresult')
 endfunc
 
+" Test for searching a pattern that is not present with 'nowrapscan'
+func Test_search_pat_not_found()
+  new
+  set nowrapscan
+  let @/ = '1abcxyz2'
+  call assert_fails('normal n', 'E385:')
+  call assert_fails('normal N', 'E384:')
+  set wrapscan&
+  close
+endfunc
+
+" Test for v:searchforward variable
+func Test_searchforward_var()
+  new
+  call setline(1, ['foo', '', 'foo'])
+  call cursor(2, 1)
+  let @/ = 'foo'
+  let v:searchforward = 0
+  normal N
+  call assert_equal(3, line('.'))
+  call cursor(2, 1)
+  let v:searchforward = 1
+  normal N
+  call assert_equal(1, line('.'))
+  close!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab