diff src/testdir/test_search.vim @ 16419:aebcd20a8a3f v8.1.1214

patch 8.1.1214: old style tests commit https://github.com/vim/vim/commit/c6b37db1ba704455daa8f9e78bc1c2492fb81f40 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 27 18:00:34 2019 +0200 patch 8.1.1214: old style tests Problem: Old style tests. Solution: Move tests from test14 to new style test files. (Yegappan Lakshmanan, closes #4308)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Apr 2019 18:15:05 +0200
parents a6cffc232b9d
children a32169a40566
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1265,3 +1265,27 @@ func Test_incsearch_add_char_under_curso
   set incsearch&
   bwipe!
 endfunc
+
+" Test for the search() function with match at the cursor position
+func Test_search_match_at_curpos()
+  new
+  call append(0, ['foobar', '', 'one two', ''])
+
+  normal gg
+
+  call search('foobar', 'c')
+  call assert_equal([1, 1], [line('.'), col('.')])
+
+  normal j
+  call search('^$', 'c')
+  call assert_equal([2, 1], [line('.'), col('.')])
+
+  call search('^$', 'bc')
+  call assert_equal([2, 1], [line('.'), col('.')])
+
+  exe "normal /two\<CR>"
+  call search('.', 'c')
+  call assert_equal([3, 5], [line('.'), col('.')])
+
+  close!
+endfunc