Mercurial > vim
diff src/testdir/test_search.vim @ 19969:b07672d13ff9 v8.2.0540
patch 8.2.0540: regexp and other code not tested
Commit: https://github.com/vim/vim/commit/004a6781b3cf15ca5dd632c38cc09bb3b253d1f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 11 17:09:31 2020 +0200
patch 8.2.0540: regexp and other code not tested
Problem: Regexp and other code not tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5904)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Apr 2020 17:15:06 +0200 |
parents | 0b42b5e50344 |
children | 9f5758ee0b10 |
line wrap: on
line diff
--- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -1593,4 +1593,23 @@ 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 + " vim: shiftwidth=2 sts=2 expandtab