test: more tests for aucmd_win remaining floating (#28214)

This commit is contained in:
zeertzjq 2024-04-07 07:10:32 +08:00 committed by GitHub
parent 9dd112dd48
commit 98d687a4e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -371,6 +371,31 @@ describe('autocmd', function()
assert_alive()
screen:expect_unchanged()
-- Also check with win_splitmove().
exec_lua [[
vim.api.nvim_buf_call(_G.buf, function()
vim.fn.win_splitmove(vim.fn.winnr(), vim.fn.win_getid(1))
end)
]]
screen:expect_unchanged()
-- Also check with nvim_win_set_config().
matches(
': Failed to move window %d+ into split$',
pcall_err(
exec_lua,
[[
vim.api.nvim_buf_call(_G.buf, function()
vim.api.nvim_win_set_config(0, {
vertical = true,
win = vim.fn.win_getid(1)
})
end)
]]
)
)
screen:expect_unchanged()
-- Ensure splitting still works from inside the aucmd_win.
exec_lua [[vim.api.nvim_buf_call(_G.buf, function() vim.cmd "split" end)]]
screen:expect [[
@ -391,12 +416,12 @@ describe('autocmd', function()
eq(
'editor',
exec_lua [[
vim.cmd "only"
vim.api.nvim_buf_call(_G.buf, function()
_G.config = vim.api.nvim_win_get_config(0)
end)
return _G.config.relative
]]
vim.cmd "only"
vim.api.nvim_buf_call(_G.buf, function()
_G.config = vim.api.nvim_win_get_config(0)
end)
return _G.config.relative
]]
)
end)
@ -437,11 +462,11 @@ describe('autocmd', function()
pcall_err(
exec_lua,
[[
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.api.nvim_win_close(win, true)
end)
]]
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.api.nvim_win_close(win, true)
end)
]]
)
)
matches(
@ -449,12 +474,12 @@ describe('autocmd', function()
pcall_err(
exec_lua,
[[
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.cmd('tabnext')
vim.api.nvim_win_close(win, true)
end)
]]
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.cmd('tabnext')
vim.api.nvim_win_close(win, true)
end)
]]
)
)
matches(
@ -462,11 +487,11 @@ describe('autocmd', function()
pcall_err(
exec_lua,
[[
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.api.nvim_win_hide(win)
end)
]]
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.api.nvim_win_hide(win)
end)
]]
)
)
matches(
@ -474,12 +499,12 @@ describe('autocmd', function()
pcall_err(
exec_lua,
[[
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.cmd('tabnext')
vim.api.nvim_win_hide(win)
end)
]]
vim.api.nvim_buf_call(_G.buf, function()
local win = vim.api.nvim_get_current_win()
vim.cmd('tabnext')
vim.api.nvim_win_hide(win)
end)
]]
)
)
end)