mirror of
https://github.com/neovim/neovim.git
synced 2026-02-21 18:01:17 +10:00
test(terminal): fix incorrect TermClose test
The test may wipe the wrong buffer if :bdelete switches to another one.
Also remove the builtin TermClose autocommand. It doesn't affect the
tests for now, but still it's better to avoid its interference.
(cherry picked from commit d42fa1753a)
This commit is contained in:
committed by
github-actions[bot]
parent
77809f0d9c
commit
26db87652e
@@ -20,13 +20,15 @@ describe('autocmd TermClose', function()
|
||||
clear()
|
||||
api.nvim_set_option_value('shell', testprg('shell-test'), {})
|
||||
command('set shellcmdflag=EXE shellredir= shellpipe= shellquote= shellxquote=')
|
||||
command('autocmd! nvim.terminal TermClose')
|
||||
end)
|
||||
|
||||
local function test_termclose_delete_own_buf()
|
||||
-- The terminal process needs to keep running so that TermClose isn't triggered immediately.
|
||||
api.nvim_set_option_value('shell', string.format('"%s" INTERACT', testprg('shell-test')), {})
|
||||
command('autocmd TermClose * bdelete!')
|
||||
command('terminal')
|
||||
local termbuf = api.nvim_get_current_buf()
|
||||
command(('autocmd TermClose * bdelete! %d'):format(termbuf))
|
||||
matches(
|
||||
'^TermClose Autocommands for "%*": Vim%(bdelete%):E937: Attempt to delete a buffer that is in use: term://',
|
||||
pcall_err(command, 'bdelete!')
|
||||
@@ -34,8 +36,7 @@ describe('autocmd TermClose', function()
|
||||
assert_alive()
|
||||
end
|
||||
|
||||
-- TODO: fixed after merging patches for `can_unload_buffer`?
|
||||
pending('TermClose deleting its own buffer, altbuf = buffer 1 #10386', function()
|
||||
it('TermClose deleting its own buffer, altbuf = buffer 1 #10386', function()
|
||||
test_termclose_delete_own_buf()
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user