mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.2320: insufficient test coverage for quickfix
Problem: Insufficient test coverage for quickfix. Solution: Add more tests. Fix uncovered problem. (Yegappan Lakshmanan, closes #5238)
This commit is contained in:
@@ -3044,12 +3044,9 @@ qf_goto_win_with_qfl_file(int qf_fnum)
|
|||||||
static int
|
static int
|
||||||
qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
|
qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
|
||||||
{
|
{
|
||||||
win_T *usable_win_ptr = NULL;
|
win_T *usable_wp = NULL;
|
||||||
int usable_win;
|
int usable_win = FALSE;
|
||||||
qf_info_T *ll_ref = NULL;
|
qf_info_T *ll_ref = NULL;
|
||||||
win_T *win;
|
|
||||||
|
|
||||||
usable_win = 0;
|
|
||||||
|
|
||||||
// If opening a new window, then don't use the location list referred by
|
// If opening a new window, then don't use the location list referred by
|
||||||
// the current window. Otherwise two windows will refer to the same
|
// the current window. Otherwise two windows will refer to the same
|
||||||
@@ -3060,17 +3057,17 @@ qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
|
|||||||
if (ll_ref != NULL)
|
if (ll_ref != NULL)
|
||||||
{
|
{
|
||||||
// Find a non-quickfix window with this location list
|
// Find a non-quickfix window with this location list
|
||||||
usable_win_ptr = qf_find_win_with_loclist(ll_ref);
|
usable_wp = qf_find_win_with_loclist(ll_ref);
|
||||||
if (usable_win_ptr != NULL)
|
if (usable_wp != NULL)
|
||||||
usable_win = 1;
|
usable_win = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!usable_win)
|
if (!usable_win)
|
||||||
{
|
{
|
||||||
// Locate a window showing a normal buffer
|
// Locate a window showing a normal buffer
|
||||||
win = qf_find_win_with_normal_buf();
|
win_T *win = qf_find_win_with_normal_buf();
|
||||||
if (win != NULL)
|
if (win != NULL)
|
||||||
usable_win = 1;
|
usable_win = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no usable window is found and 'switchbuf' contains "usetab"
|
// If no usable window is found and 'switchbuf' contains "usetab"
|
||||||
@@ -3089,7 +3086,7 @@ qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (curwin->w_llist_ref != NULL) // In a location window
|
if (curwin->w_llist_ref != NULL) // In a location window
|
||||||
qf_goto_win_with_ll_file(usable_win_ptr, qf_fnum, ll_ref);
|
qf_goto_win_with_ll_file(usable_wp, qf_fnum, ll_ref);
|
||||||
else // In a quickfix window
|
else // In a quickfix window
|
||||||
qf_goto_win_with_qfl_file(qf_fnum);
|
qf_goto_win_with_qfl_file(qf_fnum);
|
||||||
}
|
}
|
||||||
@@ -3454,17 +3451,12 @@ theend:
|
|||||||
qfl->qf_ptr = qf_ptr;
|
qfl->qf_ptr = qf_ptr;
|
||||||
qfl->qf_index = qf_index;
|
qfl->qf_index = qf_index;
|
||||||
}
|
}
|
||||||
if (p_swb != old_swb)
|
if (p_swb != old_swb && p_swb == empty_option)
|
||||||
{
|
{
|
||||||
// Restore old 'switchbuf' value, but not when an autocommand or
|
// Restore old 'switchbuf' value, but not when an autocommand or
|
||||||
// modeline has changed the value.
|
// modeline has changed the value.
|
||||||
if (p_swb == empty_option)
|
p_swb = old_swb;
|
||||||
{
|
swb_flags = old_swb_flags;
|
||||||
p_swb = old_swb;
|
|
||||||
swb_flags = old_swb_flags;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
free_string_option(old_swb);
|
|
||||||
}
|
}
|
||||||
decr_quickfix_busy();
|
decr_quickfix_busy();
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ func s:setup_commands(cchar)
|
|||||||
command! -nargs=* Xaddexpr <mods>caddexpr <args>
|
command! -nargs=* Xaddexpr <mods>caddexpr <args>
|
||||||
command! -nargs=* -count Xolder <mods><count>colder <args>
|
command! -nargs=* -count Xolder <mods><count>colder <args>
|
||||||
command! -nargs=* Xnewer <mods>cnewer <args>
|
command! -nargs=* Xnewer <mods>cnewer <args>
|
||||||
command! -nargs=* Xopen <mods>copen <args>
|
command! -nargs=* Xopen <mods> copen <args>
|
||||||
command! -nargs=* Xwindow <mods>cwindow <args>
|
command! -nargs=* Xwindow <mods>cwindow <args>
|
||||||
command! -nargs=* Xbottom <mods>cbottom <args>
|
command! -nargs=* Xbottom <mods>cbottom <args>
|
||||||
command! -nargs=* Xclose <mods>cclose <args>
|
command! -nargs=* Xclose <mods>cclose <args>
|
||||||
@@ -32,8 +32,8 @@ func s:setup_commands(cchar)
|
|||||||
command! -count -nargs=* -bang Xnfile <mods><count>cnfile<bang> <args>
|
command! -count -nargs=* -bang Xnfile <mods><count>cnfile<bang> <args>
|
||||||
command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
|
command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
|
||||||
command! -nargs=* Xexpr <mods>cexpr <args>
|
command! -nargs=* Xexpr <mods>cexpr <args>
|
||||||
command! -range -nargs=* Xvimgrep <mods><count>vimgrep <args>
|
command! -count -nargs=* Xvimgrep <mods> <count>vimgrep <args>
|
||||||
command! -nargs=* Xvimgrepadd <mods>vimgrepadd <args>
|
command! -nargs=* Xvimgrepadd <mods> vimgrepadd <args>
|
||||||
command! -nargs=* Xgrep <mods> grep <args>
|
command! -nargs=* Xgrep <mods> grep <args>
|
||||||
command! -nargs=* Xgrepadd <mods> grepadd <args>
|
command! -nargs=* Xgrepadd <mods> grepadd <args>
|
||||||
command! -nargs=* Xhelpgrep helpgrep <args>
|
command! -nargs=* Xhelpgrep helpgrep <args>
|
||||||
@@ -51,7 +51,7 @@ func s:setup_commands(cchar)
|
|||||||
command! -nargs=* Xaddexpr <mods>laddexpr <args>
|
command! -nargs=* Xaddexpr <mods>laddexpr <args>
|
||||||
command! -nargs=* -count Xolder <mods><count>lolder <args>
|
command! -nargs=* -count Xolder <mods><count>lolder <args>
|
||||||
command! -nargs=* Xnewer <mods>lnewer <args>
|
command! -nargs=* Xnewer <mods>lnewer <args>
|
||||||
command! -nargs=* Xopen <mods>lopen <args>
|
command! -nargs=* Xopen <mods> lopen <args>
|
||||||
command! -nargs=* Xwindow <mods>lwindow <args>
|
command! -nargs=* Xwindow <mods>lwindow <args>
|
||||||
command! -nargs=* Xbottom <mods>lbottom <args>
|
command! -nargs=* Xbottom <mods>lbottom <args>
|
||||||
command! -nargs=* Xclose <mods>lclose <args>
|
command! -nargs=* Xclose <mods>lclose <args>
|
||||||
@@ -69,8 +69,8 @@ func s:setup_commands(cchar)
|
|||||||
command! -count -nargs=* -bang Xnfile <mods><count>lnfile<bang> <args>
|
command! -count -nargs=* -bang Xnfile <mods><count>lnfile<bang> <args>
|
||||||
command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
|
command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
|
||||||
command! -nargs=* Xexpr <mods>lexpr <args>
|
command! -nargs=* Xexpr <mods>lexpr <args>
|
||||||
command! -range -nargs=* Xvimgrep <mods><count>lvimgrep <args>
|
command! -count -nargs=* Xvimgrep <mods> <count>lvimgrep <args>
|
||||||
command! -nargs=* Xvimgrepadd <mods>lvimgrepadd <args>
|
command! -nargs=* Xvimgrepadd <mods> lvimgrepadd <args>
|
||||||
command! -nargs=* Xgrep <mods> lgrep <args>
|
command! -nargs=* Xgrep <mods> lgrep <args>
|
||||||
command! -nargs=* Xgrepadd <mods> lgrepadd <args>
|
command! -nargs=* Xgrepadd <mods> lgrepadd <args>
|
||||||
command! -nargs=* Xhelpgrep lhelpgrep <args>
|
command! -nargs=* Xhelpgrep lhelpgrep <args>
|
||||||
@@ -157,6 +157,12 @@ func XlistTests(cchar)
|
|||||||
\ ' 2 Data.Text:20 col 10 warning 22: ModuleWarning',
|
\ ' 2 Data.Text:20 col 10 warning 22: ModuleWarning',
|
||||||
\ ' 3 Data/Text.hs:30 col 15 warning 33: FileWarning'], l)
|
\ ' 3 Data/Text.hs:30 col 15 warning 33: FileWarning'], l)
|
||||||
|
|
||||||
|
" For help entries in the quickfix list, only the filename without directory
|
||||||
|
" should be displayed
|
||||||
|
Xhelpgrep setqflist()
|
||||||
|
let l = split(execute('Xlist 1', ''), "\n")
|
||||||
|
call assert_match('^ 1 [^\\/]\{-}:', l[0])
|
||||||
|
|
||||||
" Error cases
|
" Error cases
|
||||||
call assert_fails('Xlist abc', 'E488:')
|
call assert_fails('Xlist abc', 'E488:')
|
||||||
endfunc
|
endfunc
|
||||||
@@ -269,6 +275,14 @@ func XwindowTests(cchar)
|
|||||||
Xwindow
|
Xwindow
|
||||||
call assert_true(winnr('$') == 1)
|
call assert_true(winnr('$') == 1)
|
||||||
|
|
||||||
|
" Specifying the width should adjust the width for a vertically split
|
||||||
|
" quickfix window.
|
||||||
|
vert Xopen
|
||||||
|
call assert_equal(10, winwidth(0))
|
||||||
|
vert Xopen 12
|
||||||
|
call assert_equal(12, winwidth(0))
|
||||||
|
Xclose
|
||||||
|
|
||||||
if a:cchar == 'c'
|
if a:cchar == 'c'
|
||||||
" Opening the quickfix window in multiple tab pages should reuse the
|
" Opening the quickfix window in multiple tab pages should reuse the
|
||||||
" quickfix buffer
|
" quickfix buffer
|
||||||
@@ -443,6 +457,10 @@ func Xtest_browse(cchar)
|
|||||||
call assert_fails('Xnfile', err)
|
call assert_fails('Xnfile', err)
|
||||||
call assert_fails('Xpfile', err)
|
call assert_fails('Xpfile', err)
|
||||||
|
|
||||||
|
Xexpr ''
|
||||||
|
let cmd = (a:cchar == 'c') ? '$cc' : '$ll'
|
||||||
|
call assert_fails(cmd, 'E42:')
|
||||||
|
|
||||||
call s:create_test_file('Xqftestfile1')
|
call s:create_test_file('Xqftestfile1')
|
||||||
call s:create_test_file('Xqftestfile2')
|
call s:create_test_file('Xqftestfile2')
|
||||||
|
|
||||||
@@ -466,6 +484,12 @@ func Xtest_browse(cchar)
|
|||||||
call assert_equal(5, g:Xgetlist({'idx':0}).idx)
|
call assert_equal(5, g:Xgetlist({'idx':0}).idx)
|
||||||
2Xcc
|
2Xcc
|
||||||
call assert_equal(2, g:Xgetlist({'idx':0}).idx)
|
call assert_equal(2, g:Xgetlist({'idx':0}).idx)
|
||||||
|
if a:cchar == 'c'
|
||||||
|
cc
|
||||||
|
else
|
||||||
|
ll
|
||||||
|
endif
|
||||||
|
call assert_equal(2, g:Xgetlist({'idx':0}).idx)
|
||||||
10Xcc
|
10Xcc
|
||||||
call assert_equal(6, g:Xgetlist({'idx':0}).idx)
|
call assert_equal(6, g:Xgetlist({'idx':0}).idx)
|
||||||
Xlast
|
Xlast
|
||||||
@@ -474,6 +498,14 @@ func Xtest_browse(cchar)
|
|||||||
call assert_equal(11, line('.'))
|
call assert_equal(11, line('.'))
|
||||||
call assert_fails('Xnext', 'E553')
|
call assert_fails('Xnext', 'E553')
|
||||||
call assert_fails('Xnfile', 'E553')
|
call assert_fails('Xnfile', 'E553')
|
||||||
|
" To process the range using quickfix list entries, directly use the
|
||||||
|
" quickfix commands (don't use the user defined commands)
|
||||||
|
if a:cchar == 'c'
|
||||||
|
$cc
|
||||||
|
else
|
||||||
|
$ll
|
||||||
|
endif
|
||||||
|
call assert_equal(6, g:Xgetlist({'idx':0}).idx)
|
||||||
Xrewind
|
Xrewind
|
||||||
call assert_equal('Xqftestfile1', bufname('%'))
|
call assert_equal('Xqftestfile1', bufname('%'))
|
||||||
call assert_equal(5, line('.'))
|
call assert_equal(5, line('.'))
|
||||||
@@ -577,6 +609,26 @@ func s:test_xhelpgrep(cchar)
|
|||||||
" This wipes out the buffer, make sure that doesn't cause trouble.
|
" This wipes out the buffer, make sure that doesn't cause trouble.
|
||||||
Xclose
|
Xclose
|
||||||
|
|
||||||
|
" When the current window is vertically split, jumping to a help match
|
||||||
|
" should open the help window at the top.
|
||||||
|
only | enew
|
||||||
|
let w1 = win_getid()
|
||||||
|
vert new
|
||||||
|
let w2 = win_getid()
|
||||||
|
Xnext
|
||||||
|
let w3 = win_getid()
|
||||||
|
call assert_true(&buftype == 'help')
|
||||||
|
call assert_true(winnr() == 1)
|
||||||
|
call assert_equal(['col', [['leaf', w3],
|
||||||
|
\ ['row', [['leaf', w2], ['leaf', w1]]]]], winlayout())
|
||||||
|
|
||||||
|
new | only
|
||||||
|
set buftype=help
|
||||||
|
set modified
|
||||||
|
call assert_fails('Xnext', 'E37:')
|
||||||
|
set nomodified
|
||||||
|
new | only
|
||||||
|
|
||||||
if a:cchar == 'l'
|
if a:cchar == 'l'
|
||||||
" When a help window is present, running :lhelpgrep should reuse the
|
" When a help window is present, running :lhelpgrep should reuse the
|
||||||
" help window and not the current window
|
" help window and not the current window
|
||||||
@@ -1618,9 +1670,11 @@ func Test_switchbuf()
|
|||||||
call assert_equal(winid, win_getid())
|
call assert_equal(winid, win_getid())
|
||||||
2cnext
|
2cnext
|
||||||
call assert_equal(winid, win_getid())
|
call assert_equal(winid, win_getid())
|
||||||
enew
|
|
||||||
|
|
||||||
|
" Test for 'switchbuf' set to search for files in windows in the current
|
||||||
|
" tabpage and jump to an existing window (if present)
|
||||||
set switchbuf=useopen
|
set switchbuf=useopen
|
||||||
|
enew
|
||||||
cfirst | cnext
|
cfirst | cnext
|
||||||
call assert_equal(file1_winid, win_getid())
|
call assert_equal(file1_winid, win_getid())
|
||||||
2cnext
|
2cnext
|
||||||
@@ -1628,6 +1682,8 @@ func Test_switchbuf()
|
|||||||
2cnext
|
2cnext
|
||||||
call assert_equal(file2_winid, win_getid())
|
call assert_equal(file2_winid, win_getid())
|
||||||
|
|
||||||
|
" Test for 'switchbuf' set to search for files in tabpages and jump to an
|
||||||
|
" existing tabpage (if present)
|
||||||
enew | only
|
enew | only
|
||||||
set switchbuf=usetab
|
set switchbuf=usetab
|
||||||
tabedit Xqftestfile1
|
tabedit Xqftestfile1
|
||||||
@@ -1646,6 +1702,7 @@ func Test_switchbuf()
|
|||||||
call assert_equal(4, tabpagenr())
|
call assert_equal(4, tabpagenr())
|
||||||
tabfirst | tabonly | enew
|
tabfirst | tabonly | enew
|
||||||
|
|
||||||
|
" Test for 'switchbuf' set to open a new window for every file
|
||||||
set switchbuf=split
|
set switchbuf=split
|
||||||
cfirst | cnext
|
cfirst | cnext
|
||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
@@ -1653,9 +1710,10 @@ func Test_switchbuf()
|
|||||||
call assert_equal(2, winnr('$'))
|
call assert_equal(2, winnr('$'))
|
||||||
cnext | cnext
|
cnext | cnext
|
||||||
call assert_equal(3, winnr('$'))
|
call assert_equal(3, winnr('$'))
|
||||||
enew | only
|
|
||||||
|
|
||||||
|
" Test for 'switchbuf' set to open a new tabpage for every file
|
||||||
set switchbuf=newtab
|
set switchbuf=newtab
|
||||||
|
enew | only
|
||||||
cfirst | cnext
|
cfirst | cnext
|
||||||
call assert_equal(1, tabpagenr('$'))
|
call assert_equal(1, tabpagenr('$'))
|
||||||
cnext | cnext
|
cnext | cnext
|
||||||
@@ -1672,6 +1730,8 @@ func Test_switchbuf()
|
|||||||
call assert_equal(last_winid, win_getid())
|
call assert_equal(last_winid, win_getid())
|
||||||
enew | only
|
enew | only
|
||||||
|
|
||||||
|
" With an empty 'switchbuf', jumping to a quickfix entry should open the
|
||||||
|
" file in an existing window (if present)
|
||||||
set switchbuf=
|
set switchbuf=
|
||||||
edit Xqftestfile1
|
edit Xqftestfile1
|
||||||
let file1_winid = win_getid()
|
let file1_winid = win_getid()
|
||||||
@@ -1701,6 +1761,32 @@ func Test_switchbuf()
|
|||||||
call assert_equal(4, tabpagenr())
|
call assert_equal(4, tabpagenr())
|
||||||
tabfirst | tabonly | enew | only
|
tabfirst | tabonly | enew | only
|
||||||
|
|
||||||
|
" Jumping to a file that is not present in any of the tabpages and the
|
||||||
|
" current tabpage doesn't have any usable windows, should open it in a new
|
||||||
|
" window in the current tabpage.
|
||||||
|
copen | only
|
||||||
|
cfirst
|
||||||
|
call assert_equal(1, tabpagenr())
|
||||||
|
call assert_equal('Xqftestfile1', bufname(''))
|
||||||
|
|
||||||
|
" If opening a file changes 'switchbuf', then the new value should be
|
||||||
|
" retained.
|
||||||
|
call writefile(["vim: switchbuf=split"], 'Xqftestfile1')
|
||||||
|
enew | only
|
||||||
|
set switchbuf&vim
|
||||||
|
cexpr "Xqftestfile1:1:10"
|
||||||
|
call assert_equal('split', &switchbuf)
|
||||||
|
call writefile(["vim: switchbuf=usetab"], 'Xqftestfile1')
|
||||||
|
enew | only
|
||||||
|
set switchbuf=useopen
|
||||||
|
cexpr "Xqftestfile1:1:10"
|
||||||
|
call assert_equal('usetab', &switchbuf)
|
||||||
|
call writefile(["vim: switchbuf&vim"], 'Xqftestfile1')
|
||||||
|
enew | only
|
||||||
|
set switchbuf=useopen
|
||||||
|
cexpr "Xqftestfile1:1:10"
|
||||||
|
call assert_equal('', &switchbuf)
|
||||||
|
|
||||||
call delete('Xqftestfile1')
|
call delete('Xqftestfile1')
|
||||||
call delete('Xqftestfile2')
|
call delete('Xqftestfile2')
|
||||||
call delete('Xqftestfile3')
|
call delete('Xqftestfile3')
|
||||||
@@ -1727,11 +1813,16 @@ func Xadjust_qflnum(cchar)
|
|||||||
call append(6, ['Buffer', 'Window'])
|
call append(6, ['Buffer', 'Window'])
|
||||||
|
|
||||||
let l = g:Xgetlist()
|
let l = g:Xgetlist()
|
||||||
|
|
||||||
call assert_equal(5, l[0].lnum)
|
call assert_equal(5, l[0].lnum)
|
||||||
call assert_equal(6, l[2].lnum)
|
call assert_equal(6, l[2].lnum)
|
||||||
call assert_equal(13, l[3].lnum)
|
call assert_equal(13, l[3].lnum)
|
||||||
|
|
||||||
|
" If a file doesn't have any quickfix entries, then deleting lines in the
|
||||||
|
" file should not update the quickfix list
|
||||||
|
call g:Xsetlist([], 'f')
|
||||||
|
1,2delete
|
||||||
|
call assert_equal([], g:Xgetlist())
|
||||||
|
|
||||||
enew!
|
enew!
|
||||||
call delete(fname)
|
call delete(fname)
|
||||||
endfunc
|
endfunc
|
||||||
@@ -1755,14 +1846,21 @@ 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()) == 3)
|
call assert_true(len(g:Xgetlist()) == 4)
|
||||||
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()) == 6)
|
call assert_true(len(g:Xgetlist()) == 7)
|
||||||
|
|
||||||
|
call writefile(['Vim'], 'XtestTempFile')
|
||||||
|
set makeef=XtestTempFile
|
||||||
|
silent Xgrep Grep_Test_Text: test_quickfix.vim
|
||||||
|
call assert_equal(4, len(g:Xgetlist()))
|
||||||
|
call assert_false(filereadable('XtestTempFile'))
|
||||||
|
set makeef&vim
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_grep()
|
func Test_grep()
|
||||||
@@ -2446,6 +2544,25 @@ func Test_cwindow_jump()
|
|||||||
call assert_true(winnr('$') == 2)
|
call assert_true(winnr('$') == 2)
|
||||||
call assert_true(winnr() == 1)
|
call assert_true(winnr() == 1)
|
||||||
|
|
||||||
|
" open the quickfix buffer in two windows and jump to an entry. Should open
|
||||||
|
" the file in the first quickfix window.
|
||||||
|
enew | only
|
||||||
|
copen
|
||||||
|
let bnum = bufnr('')
|
||||||
|
exe 'sbuffer ' . bnum
|
||||||
|
wincmd b
|
||||||
|
cfirst
|
||||||
|
call assert_equal(2, winnr())
|
||||||
|
call assert_equal('F1', bufname(''))
|
||||||
|
enew | only
|
||||||
|
exe 'sb' bnum
|
||||||
|
exe 'botright sb' bnum
|
||||||
|
wincmd t
|
||||||
|
clast
|
||||||
|
call assert_equal(2, winnr())
|
||||||
|
call assert_equal('quickfix', getwinvar(1, '&buftype'))
|
||||||
|
call assert_equal('quickfix', getwinvar(3, '&buftype'))
|
||||||
|
|
||||||
enew | only
|
enew | only
|
||||||
set efm&vim
|
set efm&vim
|
||||||
endfunc
|
endfunc
|
||||||
@@ -2499,7 +2616,7 @@ func XvimgrepTests(cchar)
|
|||||||
call assert_equal(2, len(l))
|
call assert_equal(2, len(l))
|
||||||
call assert_equal('Editor:Notepad NOTEPAD', l[0].text)
|
call assert_equal('Editor:Notepad NOTEPAD', l[0].text)
|
||||||
|
|
||||||
Xvimgrep #\cvim#g Xtestfile?
|
10Xvimgrep #\cvim#g Xtestfile?
|
||||||
let l = g:Xgetlist()
|
let l = g:Xgetlist()
|
||||||
call assert_equal(2, len(l))
|
call assert_equal(2, len(l))
|
||||||
call assert_equal(8, l[0].col)
|
call assert_equal(8, l[0].col)
|
||||||
@@ -3524,6 +3641,41 @@ func Test_vimgrep_autocmd()
|
|||||||
call setqflist([], 'f')
|
call setqflist([], 'f')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for an autocmd changing the current directory when running vimgrep
|
||||||
|
func Xvimgrep_autocmd_cd(cchar)
|
||||||
|
call s:setup_commands(a:cchar)
|
||||||
|
|
||||||
|
%bwipe
|
||||||
|
let save_cwd = getcwd()
|
||||||
|
|
||||||
|
augroup QF_Test
|
||||||
|
au!
|
||||||
|
autocmd BufRead * silent cd %:p:h
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
10Xvimgrep /vim/ Xdir/**
|
||||||
|
let l = g:Xgetlist()
|
||||||
|
call assert_equal('f1.txt', bufname(l[0].bufnr))
|
||||||
|
call assert_equal('f2.txt', fnamemodify(bufname(l[2].bufnr), ':t'))
|
||||||
|
|
||||||
|
augroup QF_Test
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
exe 'cd ' . save_cwd
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_vimgrep_autocmd_cd()
|
||||||
|
call mkdir('Xdir/a', 'p')
|
||||||
|
call mkdir('Xdir/b', 'p')
|
||||||
|
call writefile(['a_L1_vim', 'a_L2_vim'], 'Xdir/a/f1.txt')
|
||||||
|
call writefile(['b_L1_vim', 'b_L2_vim'], 'Xdir/b/f2.txt')
|
||||||
|
call Xvimgrep_autocmd_cd('c')
|
||||||
|
call Xvimgrep_autocmd_cd('l')
|
||||||
|
%bwipe
|
||||||
|
call delete('Xdir', 'rf')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" The following test used to crash Vim
|
" The following test used to crash Vim
|
||||||
func Test_lhelpgrep_autocmd()
|
func Test_lhelpgrep_autocmd()
|
||||||
lhelpgrep quickfix
|
lhelpgrep quickfix
|
||||||
|
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
2320,
|
||||||
/**/
|
/**/
|
||||||
2319,
|
2319,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user