From 139e6f68f937b9efcadf2709ee1c83213d3266fa Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:50:44 +0200 Subject: 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 --- test/functional/api/autocmd_spec.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/functional/api/autocmd_spec.lua') 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() -- cgit