aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_search.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-04 19:31:58 +0800
committerGitHub <noreply@github.com>2022-11-04 19:31:58 +0800
commitdce3fc3e9a455426a45db072f28604b1bc63680a (patch)
tree225d9bfb031c8c37e5aac0d4ad1ffc6ef3ed5cd8 /src/nvim/testdir/test_search.vim
parentb854f2ce093de9593278b371de796f2ace044376 (diff)
downloadrneovim-dce3fc3e9a455426a45db072f28604b1bc63680a.tar.gz
rneovim-dce3fc3e9a455426a45db072f28604b1bc63680a.tar.bz2
rneovim-dce3fc3e9a455426a45db072f28604b1bc63680a.zip
vim-patch:8.2.0540: regexp and other code not tested (#20930)
Problem: Regexp and other code not tested. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#5904) https://github.com/vim/vim/commit/004a6781b3cf15ca5dd632c38cc09bb3b253d1f8
Diffstat (limited to 'src/nvim/testdir/test_search.vim')
-rw-r--r--src/nvim/testdir/test_search.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index 0cf55c7d0b..d79910fbc1 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -1752,6 +1752,25 @@ func Test_invalid_regexp()
call assert_fails("call search('\\%#=3ab')", 'E864:')
endfunc
+" Test for searching a very complex pattern in a string. Should switch the
+" regexp engine from NFA to the old engine.
+func Test_regexp_switch_engine()
+ let l = readfile('samples/re.freeze.txt')
+ let v = substitute(l[4], '..\@<!', '', '')
+ call assert_equal(l[4], v)
+endfunc
+
+" Test for the \%V atom to search within visually selected text
+func Test_search_in_visual_area()
+ new
+ call setline(1, ['foo bar1', 'foo bar2', 'foo bar3', 'foo bar4'])
+ exe "normal 2GVjo/\\%Vbar\<CR>\<Esc>"
+ call assert_equal([2, 5], [line('.'), col('.')])
+ exe "normal 2GVj$?\\%Vbar\<CR>\<Esc>"
+ call assert_equal([3, 5], [line('.'), col('.')])
+ close!
+endfunc
+
" Test for searching with 'smartcase' and 'ignorecase'
func Test_search_smartcase()
new