Merge pull request #17929 from lewis6991/autocmd

fix(api): improve autocmd error handling
This commit is contained in:
bfredl
2022-03-31 19:28:06 +02:00
committed by GitHub
3 changed files with 33 additions and 8 deletions

View File

@@ -809,6 +809,14 @@ describe('autocmd api', function()
eq(2, get_executed_count(), "No additional counts")
end)
it('can delete non-existent groups with pcall', function()
eq(false, exec_lua[[return pcall(vim.api.nvim_del_augroup_by_name, 'noexist')]])
eq('Vim:E367: No such group: "noexist"', pcall_err(meths.del_augroup_by_name, 'noexist'))
eq(false, exec_lua[[return pcall(vim.api.nvim_del_augroup_by_id, -12342)]])
eq('Vim:E367: No such group: "--Deleted--"', pcall_err(meths.del_augroup_by_id, -12312))
end)
it('groups work with once', function()
local augroup = "TestGroup"