diff options
Diffstat (limited to 'test/functional/legacy/quickfix_spec.lua')
| -rw-r--r-- | test/functional/legacy/quickfix_spec.lua | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua index 315b8ca682..df8f2625db 100644 --- a/test/functional/legacy/quickfix_spec.lua +++ b/test/functional/legacy/quickfix_spec.lua @@ -1,8 +1,10 @@ -- Test for the quickfix commands. -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local source, clear = helpers.source, helpers.clear local eq, nvim, call = helpers.eq, helpers.meths, helpers.call +local eval = helpers.eval +local execute = helpers.execute local function expected_empty() eq({}, nvim.get_vvar('errors')) @@ -256,6 +258,25 @@ describe('helpgrep', function() \ l[3].lnum == 750 && l[3].col == 25 && l[3].text ==# 'Line 750') endfunction + + function Test_locationlist_curwin_was_closed() + augroup testgroup + au! + autocmd BufReadCmd t call R(expand("<amatch>")) + augroup END + + function R(n) + quit + endfunc + + new + let q = [] + call add(q, {'filename': 't' }) + call setloclist(0, q) + call assert_fails('lrewind', 'E924:') + + augroup! testgroup + endfunction ]]) end) @@ -306,4 +327,16 @@ describe('helpgrep', function() call('XbufferTests', 'l') expected_empty() end) + + it('autocommands triggered by quickfix can get title', function() + execute('au FileType qf let g:foo = get(w:, "quickfix_title", "NONE")') + execute('call setqflist([])') + execute('copen') + eq(':setqflist()', eval('g:foo')) + end) + + it('errors when an autocommand closes the location list\'s window', function() + call('Test_locationlist_curwin_was_closed') + expected_empty() + end) end) |
