aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/quickfix_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-12 08:06:58 -0500
committerJames McCoy <jamessan@jamessan.com>2016-11-15 23:16:08 -0500
commit7231438f124eff0ce0b9a8998ac7838abc094a8b (patch)
treeccca11f0c8cb5f332835bbe2489022f0e9a10ccd /test/functional/legacy/quickfix_spec.lua
parentaba853a156229c7df6686a6592003b5075e79e2d (diff)
downloadrneovim-7231438f124eff0ce0b9a8998ac7838abc094a8b.tar.gz
rneovim-7231438f124eff0ce0b9a8998ac7838abc094a8b.tar.bz2
rneovim-7231438f124eff0ce0b9a8998ac7838abc094a8b.zip
vim-patch:7.4.1640
Problem: Crash when an autocommand changes a quickfix list. (Dominique) Solution: Check wether an entry is still valid. (Yegappan Lakshmanan, Hirohito Higashi) https://github.com/vim/vim/commit/ffec3c53496d49668669deabc0724ec78e2274fd
Diffstat (limited to 'test/functional/legacy/quickfix_spec.lua')
-rw-r--r--test/functional/legacy/quickfix_spec.lua46
1 files changed, 45 insertions, 1 deletions
diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua
index b5a8e10a97..480e046f55 100644
--- a/test/functional/legacy/quickfix_spec.lua
+++ b/test/functional/legacy/quickfix_spec.lua
@@ -265,7 +265,7 @@ describe('helpgrep', function()
autocmd BufReadCmd t call R(expand("<amatch>"))
augroup END
- function R(n)
+ function! R(n)
quit
endfunc
@@ -406,6 +406,43 @@ describe('helpgrep', function()
augroup END
augroup! QfBufWinEnter
endfunc
+
+ function XquickfixChangedByAutocmd(cchar)
+ let Xolder = a:cchar . 'older'
+ let Xgetexpr = a:cchar . 'getexpr'
+ let Xrewind = a:cchar . 'rewind'
+ if a:cchar == 'c'
+ let Xsetlist = 'setqflist('
+ let ErrorNr = 'E925'
+ function! ReadFunc()
+ colder
+ cgetexpr []
+ endfunc
+ else
+ let Xsetlist = 'setloclist(0,'
+ let ErrorNr = 'E926'
+ function! ReadFunc()
+ lolder
+ lgetexpr []
+ endfunc
+ endif
+
+ augroup testgroup
+ au!
+ autocmd BufReadCmd t call ReadFunc()
+ augroup END
+
+ bwipe!
+ let words = [ "a", "b" ]
+ let qflist = []
+ for word in words
+ call add(qflist, {'filename': 't'})
+ exec "call " . Xsetlist . "qflist, '')"
+ endfor
+ exec "call assert_fails('" . Xrewind . "', '" . ErrorNr . ":')"
+
+ augroup! testgroup
+ endfunc
]])
end)
@@ -478,6 +515,13 @@ describe('helpgrep', function()
call('Test_locationlist')
expected_empty()
end)
+
+ it('is changed by autocmd', function()
+ call('XquickfixChangedByAutocmd', 'c')
+ expected_empty()
+ call('XquickfixChangedByAutocmd', 'l')
+ expected_empty()
+ end)
end)
describe('errorformat', function()