summaryrefslogtreecommitdiff
path: root/src/testdir/test_search.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_search.vim')
-rw-r--r--src/testdir/test_search.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 525d0d200..d59f39dc7 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1265,3 +1265,27 @@ func Test_incsearch_add_char_under_cursor()
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