diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-11 17:09:31 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-11 17:09:31 +0200 |
commit | 004a6781b3cf15ca5dd632c38cc09bb3b253d1f8 (patch) | |
tree | 7f71edb5284a22ff7e24b638303e0f5c1f5988d6 /src/testdir/test_search.vim | |
parent | d1caa941d876181aae0ebebc6ea954045bf0da24 (diff) |
patch 8.2.0540: regexp and other code not testedv8.2.0540
Problem: Regexp and other code not tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes #5904)
Diffstat (limited to 'src/testdir/test_search.vim')
-rw-r--r-- | src/testdir/test_search.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index 29943df99d..923a082b18 100644 --- 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 |