mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.1980: fix for search stat not tested
Problem: Fix for search stat not tested. Solution: Add a screenshot test. (Christian Brabandt)
This commit is contained in:
parent
b005cd80cf
commit
0f63ed33fd
10
src/testdir/dumps/Test_searchstat_1.dump
Normal file
10
src/testdir/dumps/Test_searchstat_1.dump
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|f+0&#ffffff0|o@1|b|a|r| @68
|
||||||
|
>f|i|n|d| |t|h|i|s| @65
|
||||||
|
|f|o@4|b|a|r| @65
|
||||||
|
|f|o|b|a| @70
|
||||||
|
|f|o@1|b|a|r| @68
|
||||||
|
|f|o@1|b|a|r| @68
|
||||||
|
|f|o@1| @71
|
||||||
|
|f|o@4|b|a|r| @65
|
||||||
|
|f|o|b|a| @70
|
||||||
|
|/|f|i|n|d| |t|h|i|s| @29|[|1|/|2|]| @11|2|,|1| @10|T|o|p|
|
10
src/testdir/dumps/Test_searchstat_2.dump
Normal file
10
src/testdir/dumps/Test_searchstat_2.dump
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|f+0&#ffffff0|o@1|b|a|r| @68
|
||||||
|
>f|i|n|d| |t|h|i|s| @65
|
||||||
|
|f|o@4|b|a|r| @65
|
||||||
|
|f|o|b|a| @70
|
||||||
|
|f|o@1|b|a|r| @68
|
||||||
|
|f|o@1|b|a|r| @68
|
||||||
|
|f|o@1| @71
|
||||||
|
|f|o@4|b|a|r| @65
|
||||||
|
|f|o|b|a| @70
|
||||||
|
@40|[|1|/|2|]| @11|2|,|1| @10|T|o|p|
|
@ -1,11 +1,9 @@
|
|||||||
" Tests for search_stats, when "S" is not in 'shortmess'
|
" Tests for search_stats, when "S" is not in 'shortmess'
|
||||||
"
|
|
||||||
" This test is fragile, it might not work interactively, but it works when run
|
|
||||||
" as test!
|
|
||||||
|
|
||||||
source shared.vim
|
source check.vim
|
||||||
|
source screendump.vim
|
||||||
|
|
||||||
func! Test_search_stat()
|
func Test_search_stat()
|
||||||
new
|
new
|
||||||
set shortmess-=S
|
set shortmess-=S
|
||||||
" Append 50 lines with text to search for, "foobar" appears 20 times
|
" Append 50 lines with text to search for, "foobar" appears 20 times
|
||||||
@ -177,11 +175,41 @@ func! Test_search_stat()
|
|||||||
let stat = '\[1/2\]'
|
let stat = '\[1/2\]'
|
||||||
call assert_notmatch(pat .. stat, g:b)
|
call assert_notmatch(pat .. stat, g:b)
|
||||||
call assert_match(stat, g:b)
|
call assert_match(stat, g:b)
|
||||||
|
" Test that the message is not truncated
|
||||||
|
" it would insert '...' into the output.
|
||||||
|
call assert_match('^\s\+' .. stat, g:b)
|
||||||
unmap n
|
unmap n
|
||||||
|
|
||||||
" Clean up
|
" Clean up
|
||||||
set shortmess+=S
|
set shortmess+=S
|
||||||
|
|
||||||
" close the window
|
" close the window
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func! Test_search_stat_screendump()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set shortmess-=S
|
||||||
|
" Append 50 lines with text to search for, "foobar" appears 20 times
|
||||||
|
call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 20))
|
||||||
|
call setline(2, 'find this')
|
||||||
|
call setline(70, 'find this')
|
||||||
|
nnoremap n n
|
||||||
|
let @/ = 'find this'
|
||||||
|
call cursor(1,1)
|
||||||
|
norm n
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xsearchstat')
|
||||||
|
let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10})
|
||||||
|
call term_wait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_searchstat_1', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":nnoremap <silent> n n\<cr>")
|
||||||
|
call term_sendkeys(buf, "gg0n")
|
||||||
|
call term_wait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_searchstat_2', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('Xsearchstat')
|
||||||
|
endfunc
|
||||||
|
@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1980,
|
||||||
/**/
|
/**/
|
||||||
1979,
|
1979,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user