diff --git a/test/functional/autocmd/termxx_spec.lua b/test/functional/autocmd/termxx_spec.lua index 6841344aa4..d3d7e02fbe 100644 --- a/test/functional/autocmd/termxx_spec.lua +++ b/test/functional/autocmd/termxx_spec.lua @@ -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)