fix(api): crash after nvim_win_set_config title/footer validation error (#26606)

This commit is contained in:
notomo
2023-12-16 22:58:04 +09:00
committed by GitHub
parent 574519d9d6
commit c18f3cfcdb
2 changed files with 52 additions and 18 deletions

View File

@@ -906,4 +906,38 @@ describe('API/win', function()
eq(footer, cfg.footer)
end)
end)
describe('set_config', function()
it('no crash with invalid title', function ()
local win = meths.open_win(0, true, {
width = 10,
height = 10,
relative = "editor",
row = 10,
col = 10,
title = { { "test" } },
border = "single",
})
eq("title/footer cannot be an empty array",
pcall_err(meths.win_set_config, win, {title = {}}))
command("redraw!")
assert_alive()
end)
it('no crash with invalid footer', function ()
local win = meths.open_win(0, true, {
width = 10,
height = 10,
relative = "editor",
row = 10,
col = 10,
footer = { { "test" } },
border = "single",
})
eq("title/footer cannot be an empty array",
pcall_err(meths.win_set_config, win, {footer = {}}))
command("redraw!")
assert_alive()
end)
end)
end)