diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-06 04:52:06 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-06 22:43:47 -0400 |
| commit | fb2b0fa5babe4d3f68012c12345ed32e82584c3b (patch) | |
| tree | e93a0199e1e86251d7019fb4a4e53295d82111f2 /src/nvim/testdir/test_quickfix.vim | |
| parent | 0234d579a72a81349901c7ec4f7bca6b4bc6f132 (diff) | |
| download | rneovim-fb2b0fa5babe4d3f68012c12345ed32e82584c3b.tar.gz rneovim-fb2b0fa5babe4d3f68012c12345ed32e82584c3b.tar.bz2 rneovim-fb2b0fa5babe4d3f68012c12345ed32e82584c3b.zip | |
vim-patch:8.0.1669: :vimgrep may add entries to the wrong quickfix list
Problem: :vimgrep may add entries to the wrong quickfix list.
Solution: Use the list identifier. (Yegappan Lakshmanan)
https://github.com/vim/vim/commit/e1bb879f49665bb828197135b80aaf72cc190073
Diffstat (limited to 'src/nvim/testdir/test_quickfix.vim')
| -rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 9fbd3d25bd..f775b77ca0 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -3319,3 +3319,44 @@ func Test_lfile_crash() call assert_fails('lfile', 'E40') au! QuickFixCmdPre endfunc + +" Tests for quickfix/location lists changed by autocommands when +" :vimgrep/:lvimgrep commands are running. +func Test_vimgrep_autocmd() + call setqflist([], 'f') + call writefile(['stars'], 'Xtest1.txt') + call writefile(['stars'], 'Xtest2.txt') + + " Test 1: + " When searching for a pattern using :vimgrep, if the quickfix list is + " changed by an autocmd, the results should be added to the correct quickfix + " list. + autocmd BufRead Xtest2.txt cexpr '' | cexpr '' + silent vimgrep stars Xtest*.txt + call assert_equal(1, getqflist({'nr' : 0}).nr) + call assert_equal(3, getqflist({'nr' : '$'}).nr) + call assert_equal('Xtest2.txt', bufname(getqflist()[1].bufnr)) + au! BufRead Xtest2.txt + + " Test 2: + " When searching for a pattern using :vimgrep, if the quickfix list is + " freed, then a error should be given. + silent! %bwipe! + call setqflist([], 'f') + autocmd BufRead Xtest2.txt for i in range(10) | cexpr '' | endfor + call assert_fails('vimgrep stars Xtest*.txt', 'E925:') + au! BufRead Xtest2.txt + + " Test 3: + " When searching for a pattern using :lvimgrep, if the location list is + " freed, then the command should error out. + silent! %bwipe! + let g:save_winid = win_getid() + autocmd BufRead Xtest2.txt call setloclist(g:save_winid, [], 'f') + call assert_fails('lvimgrep stars Xtest*.txt', 'E926:') + au! BufRead Xtest2.txt + + call delete('Xtest1.txt') + call delete('Xtest2.txt') + call setqflist([], 'f') +endfunc |