diff options
author | ii14 <59243201+ii14@users.noreply.github.com> | 2023-10-09 11:50:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 02:50:44 -0700 |
commit | 139e6f68f937b9efcadf2709ee1c83213d3266fa (patch) | |
tree | 7daa6dbc0f9c207980a2757620cfcc2c6f6f42d9 /test/functional/api/autocmd_spec.lua | |
parent | 8e932480f61d6101bf8bea1abc07ed93826221fd (diff) | |
download | rneovim-139e6f68f937b9efcadf2709ee1c83213d3266fa.tar.gz rneovim-139e6f68f937b9efcadf2709ee1c83213d3266fa.tar.bz2 rneovim-139e6f68f937b9efcadf2709ee1c83213d3266fa.zip |
fix(autocmd): API functions accept garbage after event name #25523
"VimEnter foo" was accepted as a valid event name for "VimEnter".
Events delimited with commas, eg. "VimEnter,BufRead", were also
accepted, even though only the first event was actually parsed.
Co-authored-by: ii14 <ii14@users.noreply.github.com>
Diffstat (limited to 'test/functional/api/autocmd_spec.lua')
-rw-r--r-- | test/functional/api/autocmd_spec.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua index ba267e7539..bcae35d724 100644 --- a/test/functional/api/autocmd_spec.lua +++ b/test/functional/api/autocmd_spec.lua @@ -43,6 +43,11 @@ describe('autocmd api', function() group = 0, command = 'ls', })) + + eq("Invalid 'event': 'foo'", pcall_err(meths.create_autocmd, 'foo', { command = '' })) + eq("Invalid 'event': 'VimEnter '", pcall_err(meths.create_autocmd, 'VimEnter ', { command = '' })) + eq("Invalid 'event': 'VimEnter foo'", pcall_err(meths.create_autocmd, 'VimEnter foo', { command = '' })) + eq("Invalid 'event': 'BufAdd,BufDelete'", pcall_err(meths.create_autocmd, 'BufAdd,BufDelete', { command = '' })) end) it('doesnt leak when you use ++once', function() |