diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-03-31 09:59:14 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2022-03-31 14:23:53 +0100 |
commit | 929293815bc6b9b1b5fdd129970c4e2f7279a6d6 (patch) | |
tree | cb9dbc314fc835238a72b0da84f03eb63f8e0063 /test | |
parent | 1184097261260e53519db54548acf2c1e5ab7e68 (diff) | |
download | rneovim-929293815bc6b9b1b5fdd129970c4e2f7279a6d6.tar.gz rneovim-929293815bc6b9b1b5fdd129970c4e2f7279a6d6.tar.bz2 rneovim-929293815bc6b9b1b5fdd129970c4e2f7279a6d6.zip |
fix(api): improve autocmd error handling
- nvim_del_augroup_* now works with pcall
- nvim_del_autocmd now errors for invalid ids
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/autocmd_spec.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua index b8fbd4f9a5..25220f7e74 100644 --- a/test/functional/api/autocmd_spec.lua +++ b/test/functional/api/autocmd_spec.lua @@ -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" |