aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_search_stat.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_search_stat.vim')
-rw-r--r--src/nvim/testdir/test_search_stat.vim43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/nvim/testdir/test_search_stat.vim b/src/nvim/testdir/test_search_stat.vim
index 322d137e2e..0f52158560 100644
--- a/src/nvim/testdir/test_search_stat.vim
+++ b/src/nvim/testdir/test_search_stat.vim
@@ -11,7 +11,7 @@ func! Test_search_stat()
" Append 50 lines with text to search for, "foobar" appears 20 times
call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 10))
- " 1) match at second line
+ " match at second line
call cursor(1, 1)
let @/ = 'fo*\(bar\?\)\?'
let g:a = execute(':unsilent :norm! n')
@@ -19,13 +19,13 @@ func! Test_search_stat()
let pat = escape(@/, '()*?'). '\s\+'
call assert_match(pat .. stat, g:a)
- " 2) Match at last line
+ " Match at last line
call cursor(line('$')-2, 1)
let g:a = execute(':unsilent :norm! n')
let stat = '\[50/50\]'
call assert_match(pat .. stat, g:a)
- " 3) No search stat
+ " No search stat
set shortmess+=S
call cursor(1, 1)
let stat = '\[2/50\]'
@@ -33,7 +33,7 @@ func! Test_search_stat()
call assert_notmatch(pat .. stat, g:a)
set shortmess-=S
- " 4) Many matches
+ " Many matches
call cursor(line('$')-2, 1)
let @/ = '.'
let pat = escape(@/, '()*?'). '\s\+'
@@ -45,7 +45,7 @@ func! Test_search_stat()
let stat = '\[1/>99\] W'
call assert_match(pat .. stat, g:a)
- " 5) Many matches
+ " Many matches
call cursor(1, 1)
let g:a = execute(':unsilent :norm! n')
let stat = '\[2/>99\]'
@@ -55,7 +55,7 @@ func! Test_search_stat()
let stat = '\[>99/>99\] W'
call assert_match(pat .. stat, g:a)
- " 6) right-left
+ " right-left
if exists("+rightleft")
set rl
call cursor(1,1)
@@ -67,7 +67,7 @@ func! Test_search_stat()
set norl
endif
- " 7) right-left bottom
+ " right-left bottom
if exists("+rightleft")
set rl
call cursor('$',1)
@@ -78,7 +78,7 @@ func! Test_search_stat()
set norl
endif
- " 8) right-left back at top
+ " right-left back at top
if exists("+rightleft")
set rl
call cursor('$',1)
@@ -90,7 +90,7 @@ func! Test_search_stat()
set norl
endif
- " 9) normal, back at bottom
+ " normal, back at bottom
call cursor(1,1)
let @/ = 'foobar'
let pat = '?foobar\s\+'
@@ -100,7 +100,7 @@ func! Test_search_stat()
call assert_match('search hit TOP, continuing at BOTTOM', g:a)
call assert_match('\[20/20\] W', Screenline(&lines))
- " 10) normal, no match
+ " normal, no match
call cursor(1,1)
let @/ = 'zzzzzz'
let g:a = ''
@@ -114,7 +114,26 @@ func! Test_search_stat()
call assert_false(1)
endtry
- " 11) normal, n comes from a mapping
+ " with count
+ call cursor(1, 1)
+ let @/ = 'fo*\(bar\?\)\?'
+ let g:a = execute(':unsilent :norm! 2n')
+ let stat = '\[3/50\]'
+ let pat = escape(@/, '()*?'). '\s\+'
+ call assert_match(pat .. stat, g:a)
+ let g:a = execute(':unsilent :norm! 2n')
+ let stat = '\[5/50\]'
+ call assert_match(pat .. stat, g:a)
+
+ " with offset
+ call cursor(1, 1)
+ call feedkeys("/fo*\\(bar\\?\\)\\?/+1\<cr>", 'tx')
+ let g:a = execute(':unsilent :norm! n')
+ let stat = '\[5/50\]'
+ let pat = escape(@/ .. '/+1', '()*?'). '\s\+'
+ call assert_match(pat .. stat, g:a)
+
+ " normal, n comes from a mapping
" Need to move over more than 64 lines to trigger char_avail(.
nnoremap n nzv
call cursor(1,1)
@@ -130,7 +149,7 @@ func! Test_search_stat()
call assert_match(pat .. stat, g:b)
unmap n
- " 11) normal, but silent
+ " normal, but silent
call cursor(1,1)
let @/ = 'find this'
let pat = '/find this\s\+'