Skip to content

Commit d8a8c4c

Browse files
committed
patch 8.1.2310: no proper test for directory changes in quickfix
Problem: No proper test for directory changes in quickfix. Solution: Add a test that uses multiple directories. (Yegappan Lakshmanan, closes #5230)
1 parent abe12a1 commit d8a8c4c

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

src/testdir/test_quickfix.vim

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4393,4 +4393,46 @@ func Test_qfcmd_abort()
43934393
augroup END
43944394
endfunc
43954395

4396+
" Test for using a file in one of the parent directories.
4397+
func Test_search_in_dirstack()
4398+
call mkdir('Xtestdir/a/b/c', 'p')
4399+
let save_cwd = getcwd()
4400+
call writefile(["X1_L1", "X1_L2"], 'Xtestdir/Xfile1')
4401+
call writefile(["X2_L1", "X2_L2"], 'Xtestdir/a/Xfile2')
4402+
call writefile(["X3_L1", "X3_L2"], 'Xtestdir/a/b/Xfile3')
4403+
call writefile(["X4_L1", "X4_L2"], 'Xtestdir/a/b/c/Xfile4')
4404+
4405+
let lines = "Entering dir Xtestdir\n" .
4406+
\ "Entering dir a\n" .
4407+
\ "Entering dir b\n" .
4408+
\ "Xfile2:2:X2_L2\n" .
4409+
\ "Leaving dir a\n" .
4410+
\ "Xfile1:2:X1_L2\n" .
4411+
\ "Xfile3:1:X3_L1\n" .
4412+
\ "Entering dir c\n" .
4413+
\ "Xfile4:2:X4_L2\n" .
4414+
\ "Leaving dir c\n" .
4415+
\ "Leaving dir Xtestdir\n"
4416+
set efm=%DEntering\ dir\ %f,%XLeaving\ dir\ %f,%f:%l:%m
4417+
cexpr lines
4418+
call assert_equal(11, getqflist({'size' : 0}).size)
4419+
call assert_equal(4, getqflist({'idx' : 0}).idx)
4420+
call assert_equal('X2_L2', getline('.'))
4421+
cnext
4422+
call assert_equal(6, getqflist({'idx' : 0}).idx)
4423+
call assert_equal('X1_L2', getline('.'))
4424+
cnext
4425+
call assert_equal(7, getqflist({'idx' : 0}).idx)
4426+
call assert_equal(1, line('$'))
4427+
call assert_equal('', getline(1))
4428+
cnext
4429+
call assert_equal(9, getqflist({'idx' : 0}).idx)
4430+
call assert_equal(1, line('$'))
4431+
call assert_equal('', getline(1))
4432+
4433+
set efm&
4434+
exe 'cd ' . save_cwd
4435+
call delete('Xtestdir', 'rf')
4436+
endfunc
4437+
43964438
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
2310,
744746
/**/
745747
2309,
746748
/**/

0 commit comments

Comments
 (0)