test: add tests for #14379

This commit is contained in:
zeertzjq
2026-01-20 06:32:32 +08:00
parent 537e8d69f8
commit 9ba985c250
2 changed files with 44 additions and 0 deletions

View File

@@ -118,3 +118,31 @@ describe(':cquit', function()
)
end)
end)
describe('no crash after :quit non-last window during exit', function()
before_each(function()
n.clear()
end)
it('in vim.schedule() callback and when piping to stdin #14379', function()
n.fn.system({
n.nvim_prog,
'-es',
'--cmd',
"lua vim.schedule(function() vim.cmd('vsplit | quit') end)",
'+quit',
}, '')
eq(0, n.api.nvim_get_vvar('shell_error'))
end)
it('in vim.defer_fn() callback and when piping to stdin #14379', function()
n.fn.system({
n.nvim_prog,
'-es',
'--cmd',
"lua vim.defer_fn(function() vim.cmd('vsplit | quit') end, 0)",
'+quit',
}, '')
eq(0, n.api.nvim_get_vvar('shell_error'))
end)
end)

View File

@@ -2169,6 +2169,22 @@ describe('TUI', function()
screen:expect({ any = vim.pesc('[Process exited 1]') })
end)
it('exits properly when :quit non-last window in event handler #14379', function()
local code = [[
vim.defer_fn(function()
vim.cmd('vsplit | quit')
end, 0)
vim.cmd('quit')
]]
child_session:notify('nvim_exec_lua', code, {})
screen:expect([[
|
[Process exited 0]^ |
|*4
{3:-- TERMINAL --} |
]])
end)
it('no stack-use-after-scope with cursor color #22432', function()
screen:set_option('rgb', true)
command('set termguicolors')