mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
patch 8.1.2360: quickfix test coverage can still be improved
Problem: Quickfix test coverage can still be improved. Solution: Add more test cases. (Yegappan Lakshmanan, closes #5276)
This commit is contained in:
parent
0387cae15c
commit
15a7bdcb77
@ -270,6 +270,9 @@ func XwindowTests(cchar)
|
|||||||
\ winheight('.') == 7 &&
|
\ winheight('.') == 7 &&
|
||||||
\ getline('.') ==# '|| non-error 1')
|
\ getline('.') ==# '|| non-error 1')
|
||||||
|
|
||||||
|
" :cnext in quickfix window should move to the next entry
|
||||||
|
Xnext
|
||||||
|
call assert_equal(2, g:Xgetlist({'idx' : 0}).idx)
|
||||||
|
|
||||||
" Calling cwindow should close the quickfix window with no valid errors
|
" Calling cwindow should close the quickfix window with no valid errors
|
||||||
Xwindow
|
Xwindow
|
||||||
@ -456,16 +459,18 @@ func Xtest_browse(cchar)
|
|||||||
" result in failure
|
" result in failure
|
||||||
if a:cchar == 'c'
|
if a:cchar == 'c'
|
||||||
let err = 'E42:'
|
let err = 'E42:'
|
||||||
|
let cmd = '$cc'
|
||||||
else
|
else
|
||||||
let err = 'E776:'
|
let err = 'E776:'
|
||||||
|
let cmd = '$ll'
|
||||||
endif
|
endif
|
||||||
call assert_fails('Xnext', err)
|
call assert_fails('Xnext', err)
|
||||||
call assert_fails('Xprev', err)
|
call assert_fails('Xprev', err)
|
||||||
call assert_fails('Xnfile', err)
|
call assert_fails('Xnfile', err)
|
||||||
call assert_fails('Xpfile', err)
|
call assert_fails('Xpfile', err)
|
||||||
|
call assert_fails(cmd, err)
|
||||||
|
|
||||||
Xexpr ''
|
Xexpr ''
|
||||||
let cmd = (a:cchar == 'c') ? '$cc' : '$ll'
|
|
||||||
call assert_fails(cmd, 'E42:')
|
call assert_fails(cmd, 'E42:')
|
||||||
|
|
||||||
call s:create_test_file('Xqftestfile1')
|
call s:create_test_file('Xqftestfile1')
|
||||||
@ -1886,19 +1891,26 @@ func s:test_xgrep(cchar)
|
|||||||
enew! | only
|
enew! | only
|
||||||
set makeef&vim
|
set makeef&vim
|
||||||
silent Xgrep Grep_Test_Text: test_quickfix.vim
|
silent Xgrep Grep_Test_Text: test_quickfix.vim
|
||||||
call assert_true(len(g:Xgetlist()) == 4)
|
call assert_true(len(g:Xgetlist()) == 5)
|
||||||
Xopen
|
Xopen
|
||||||
call assert_true(w:quickfix_title =~ '^:grep')
|
call assert_true(w:quickfix_title =~ '^:grep')
|
||||||
Xclose
|
Xclose
|
||||||
enew
|
enew
|
||||||
set makeef=Temp_File_##
|
set makeef=Temp_File_##
|
||||||
silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim
|
silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim
|
||||||
call assert_true(len(g:Xgetlist()) == 7)
|
call assert_true(len(g:Xgetlist()) == 9)
|
||||||
|
|
||||||
|
" Try with 'grepprg' set to 'internal'
|
||||||
|
set grepprg=internal
|
||||||
|
silent Xgrep Grep_Test_Text: test_quickfix.vim
|
||||||
|
silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim
|
||||||
|
call assert_true(len(g:Xgetlist()) == 9)
|
||||||
|
set grepprg&vim
|
||||||
|
|
||||||
call writefile(['Vim'], 'XtestTempFile')
|
call writefile(['Vim'], 'XtestTempFile')
|
||||||
set makeef=XtestTempFile
|
set makeef=XtestTempFile
|
||||||
silent Xgrep Grep_Test_Text: test_quickfix.vim
|
silent Xgrep Grep_Test_Text: test_quickfix.vim
|
||||||
call assert_equal(4, len(g:Xgetlist()))
|
call assert_equal(5, len(g:Xgetlist()))
|
||||||
call assert_false(filereadable('XtestTempFile'))
|
call assert_false(filereadable('XtestTempFile'))
|
||||||
set makeef&vim
|
set makeef&vim
|
||||||
endfunc
|
endfunc
|
||||||
@ -2458,6 +2470,12 @@ func Test_Autocmd()
|
|||||||
silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim
|
silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim
|
||||||
silent grep abc123def Xtest
|
silent grep abc123def Xtest
|
||||||
silent grepadd abc123def Xtest
|
silent grepadd abc123def Xtest
|
||||||
|
set grepprg=internal
|
||||||
|
silent grep Grep_Autocmd_Text test_quickfix.vim
|
||||||
|
silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim
|
||||||
|
silent lgrep Grep_Autocmd_Text test_quickfix.vim
|
||||||
|
silent lgrepadd GrepAdd_Autocmd_Text test_quickfix.vim
|
||||||
|
set grepprg&vim
|
||||||
let l = ['pregrep',
|
let l = ['pregrep',
|
||||||
\ 'postgrep',
|
\ 'postgrep',
|
||||||
\ 'pregrepadd',
|
\ 'pregrepadd',
|
||||||
@ -2465,7 +2483,15 @@ func Test_Autocmd()
|
|||||||
\ 'pregrep',
|
\ 'pregrep',
|
||||||
\ 'postgrep',
|
\ 'postgrep',
|
||||||
\ 'pregrepadd',
|
\ 'pregrepadd',
|
||||||
\ 'postgrepadd']
|
\ 'postgrepadd',
|
||||||
|
\ 'pregrep',
|
||||||
|
\ 'postgrep',
|
||||||
|
\ 'pregrepadd',
|
||||||
|
\ 'postgrepadd',
|
||||||
|
\ 'prelgrep',
|
||||||
|
\ 'postlgrep',
|
||||||
|
\ 'prelgrepadd',
|
||||||
|
\ 'postlgrepadd']
|
||||||
call assert_equal(l, g:acmds)
|
call assert_equal(l, g:acmds)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -2603,6 +2629,19 @@ func Test_cwindow_jump()
|
|||||||
call assert_equal('quickfix', getwinvar(1, '&buftype'))
|
call assert_equal('quickfix', getwinvar(1, '&buftype'))
|
||||||
call assert_equal('quickfix', getwinvar(3, '&buftype'))
|
call assert_equal('quickfix', getwinvar(3, '&buftype'))
|
||||||
|
|
||||||
|
" Jumping to a file from the location list window should find a usuable
|
||||||
|
" window by wrapping around the window list.
|
||||||
|
enew | only
|
||||||
|
call setloclist(0, [], 'f')
|
||||||
|
new | new
|
||||||
|
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
|
||||||
|
lopen
|
||||||
|
1close
|
||||||
|
call assert_equal(0, getloclist(3, {'id' : 0}).id)
|
||||||
|
lnext
|
||||||
|
call assert_equal(3, winnr())
|
||||||
|
call assert_equal(getloclist(1, {'id' : 0}).id, getloclist(3, {'id' : 0}).id)
|
||||||
|
|
||||||
enew | only
|
enew | only
|
||||||
set efm&vim
|
set efm&vim
|
||||||
endfunc
|
endfunc
|
||||||
|
@ -737,6 +737,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 */
|
||||||
|
/**/
|
||||||
|
2360,
|
||||||
/**/
|
/**/
|
||||||
2359,
|
2359,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user