aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/termxx_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/autocmd/termxx_spec.lua')
-rw-r--r--test/functional/autocmd/termxx_spec.lua26
1 files changed, 23 insertions, 3 deletions
diff --git a/test/functional/autocmd/termxx_spec.lua b/test/functional/autocmd/termxx_spec.lua
index 1e8f981437..859c2ebf44 100644
--- a/test/functional/autocmd/termxx_spec.lua
+++ b/test/functional/autocmd/termxx_spec.lua
@@ -1,21 +1,41 @@
local luv = require('luv')
local helpers = require('test.functional.helpers')(after_each)
-local clear, command, nvim, nvim_dir =
- helpers.clear, helpers.command, helpers.nvim, helpers.nvim_dir
+local clear, command, nvim, testprg =
+ helpers.clear, helpers.command, helpers.nvim, helpers.testprg
local eval, eq, neq, retry =
helpers.eval, helpers.eq, helpers.neq, helpers.retry
local ok = helpers.ok
local feed = helpers.feed
+local pcall_err = helpers.pcall_err
+local assert_alive = helpers.assert_alive
local iswin = helpers.iswin
describe('autocmd TermClose', function()
before_each(function()
clear()
- nvim('set_option', 'shell', nvim_dir .. '/shell-test')
+ nvim('set_option', 'shell', testprg('shell-test'))
command('set shellcmdflag=EXE shellredir= shellpipe= shellquote= shellxquote=')
end)
+
+ local function test_termclose_delete_own_buf()
+ command('autocmd TermClose * bdelete!')
+ command('terminal')
+ eq('Vim(bdelete):E937: Attempt to delete a buffer that is in use', pcall_err(command, 'bdelete!'))
+ assert_alive()
+ end
+
+ -- TODO: fixed after merging patches for `can_unload_buffer`?
+ pending('TermClose deleting its own buffer, altbuf = buffer 1 #10386', function()
+ test_termclose_delete_own_buf()
+ end)
+
+ it('TermClose deleting its own buffer, altbuf NOT buffer 1 #10386', function()
+ command('edit foo1')
+ test_termclose_delete_own_buf()
+ end)
+
it('triggers when fast-exiting terminal job stops', function()
command('autocmd TermClose * let g:test_termclose = 23')
command('terminal')