summaryrefslogtreecommitdiff
path: root/src/testdir/test_search.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-28 21:52:17 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-28 21:52:17 +0200
commitdb51007108a6ab0671e7f7b4844557cbe647185f (patch)
treeadd62305033a8f8aacc513705f5eb15d61ff3174 /src/testdir/test_search.vim
parent24a98a0eb77245adc50facad8b735b20bfd31a7e (diff)
downloadvim-git-db51007108a6ab0671e7f7b4844557cbe647185f.tar.gz
patch 8.0.1158: still old style testsv8.0.1158
Problem: Still old style tests. Solution: Convert serveral tests to new style. (Yegappan Lakshmanan)
Diffstat (limited to 'src/testdir/test_search.vim')
-rw-r--r--src/testdir/test_search.vim56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 69b1335ef..5ae101f1e 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -356,3 +356,59 @@ func Test_search_cmdline4()
call test_override("char_avail", 0)
bw!
endfunc
+
+" Tests for regexp with various magic settings
+func Test_search_regexp()
+ enew!
+
+ put ='1 a aa abb abbccc'
+ exe 'normal! /a*b\{2}c\+/e' . "\<CR>"
+ call assert_equal([0, 2, 17, 0], getpos('.'))
+
+ put ='2 d dd dee deefff'
+ exe 'normal! /\Md\*e\{2}f\+/e' . "\<CR>"
+ call assert_equal([0, 3, 17, 0], getpos('.'))
+
+ set nomagic
+ put ='3 g gg ghh ghhiii'
+ exe 'normal! /g\*h\{2}i\+/e' . "\<CR>"
+ call assert_equal([0, 4, 17, 0], getpos('.'))
+
+ put ='4 j jj jkk jkklll'
+ exe 'normal! /\mj*k\{2}l\+/e' . "\<CR>"
+ call assert_equal([0, 5, 17, 0], getpos('.'))
+
+ put ='5 m mm mnn mnnooo'
+ exe 'normal! /\vm*n{2}o+/e' . "\<CR>"
+ call assert_equal([0, 6, 17, 0], getpos('.'))
+
+ put ='6 x ^aa$ x'
+ exe 'normal! /\V^aa$' . "\<CR>"
+ call assert_equal([0, 7, 5, 0], getpos('.'))
+
+ set magic
+ put ='7 (a)(b) abbaa'
+ exe 'normal! /\v(a)(b)\2\1\1/e' . "\<CR>"
+ call assert_equal([0, 8, 14, 0], getpos('.'))
+
+ put ='8 axx [ab]xx'
+ exe 'normal! /\V[ab]\(\[xy]\)\1' . "\<CR>"
+ call assert_equal([0, 9, 7, 0], getpos('.'))
+
+ set undolevels=100
+ put ='9 foobar'
+ put =''
+ exe "normal! a\<C-G>u\<Esc>"
+ normal G
+ exe 'normal! dv?bar?' . "\<CR>"
+ call assert_equal('9 foo', getline('.'))
+ call assert_equal([0, 10, 5, 0], getpos('.'))
+ call assert_equal(10, line('$'))
+ normal u
+ call assert_equal('9 foobar', getline('.'))
+ call assert_equal([0, 10, 6, 0], getpos('.'))
+ call assert_equal(11, line('$'))
+
+ set undolevels&
+ enew!
+endfunc