diff options
author | notomo <notomo.motono@gmail.com> | 2023-12-16 22:58:04 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-16 21:58:04 +0800 |
commit | c18f3cfcdb8fc5a39b7c898eea619e3de94096b4 (patch) | |
tree | bc94fe0afec9c744a628f6899b0a9cb0198dd006 /test/functional/api/window_spec.lua | |
parent | 574519d9d68f7f28a868e95ef0d081cbae6ddec4 (diff) | |
download | rneovim-c18f3cfcdb8fc5a39b7c898eea619e3de94096b4.tar.gz rneovim-c18f3cfcdb8fc5a39b7c898eea619e3de94096b4.tar.bz2 rneovim-c18f3cfcdb8fc5a39b7c898eea619e3de94096b4.zip |
fix(api): crash after nvim_win_set_config title/footer validation error (#26606)
Diffstat (limited to 'test/functional/api/window_spec.lua')
-rw-r--r-- | test/functional/api/window_spec.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 67284c01e0..f44326d0eb 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -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) |