diff options
author | James McCoy <jamessan@jamessan.com> | 2016-11-16 06:52:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-16 06:52:19 -0500 |
commit | 108d54bbd455635fc29541eb4bae4b9f3318aafb (patch) | |
tree | d5d829f41de3c7d151f62910f00c81bad873e47b /test/functional/legacy/quickfix_spec.lua | |
parent | c66ca17ca1a2f396252bc554198f9e73c7073385 (diff) | |
parent | 34317846d6fa9c2d3b23742abc455eafca0e92e4 (diff) | |
download | rneovim-108d54bbd455635fc29541eb4bae4b9f3318aafb.tar.gz rneovim-108d54bbd455635fc29541eb4bae4b9f3318aafb.tar.bz2 rneovim-108d54bbd455635fc29541eb4bae4b9f3318aafb.zip |
Merge pull request #5600 from jamessan/vim-7.4.1640
vim-patch:7.4.1640,7.4.1647,7.4.1650,7.4.1664
Diffstat (limited to 'test/functional/legacy/quickfix_spec.lua')
-rw-r--r-- | test/functional/legacy/quickfix_spec.lua | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua index b5a8e10a97..5787ff8ff3 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,56 @@ 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 + + func Test_caddbuffer_to_empty() + helpgr quickfix + call setqflist([], 'r') + cad + try + silent cn + catch + " number of matches is unknown + call assert_true(v:exception =~ 'E553:') + endtry + quit! + endfunc ]]) end) @@ -478,6 +528,24 @@ 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) + + it('does not crash after using caddbuffer with an empty qf list', function() + call('Test_caddbuffer_to_empty') + expected_empty() + end) + + it('cgetexpr does not crash with a NULL element in a list', function() + execute('cgetexpr [$x]') + -- Still alive? + eq(2, eval('1+1')) + end) end) describe('errorformat', function() |