aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/command_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-04-14 13:02:58 +0800
committerGitHub <noreply@github.com>2025-04-14 05:02:58 +0000
commit51caf0a3af599bc4eacdc4b87092bb20286dbfe8 (patch)
tree3952a45af089d14c226e89355fc02d20c82a579f /test/functional/api/command_spec.lua
parentfd76646a95e3035a166a2582fdd7a21dca9ececa (diff)
downloadrneovim-51caf0a3af599bc4eacdc4b87092bb20286dbfe8.tar.gz
rneovim-51caf0a3af599bc4eacdc4b87092bb20286dbfe8.tar.bz2
rneovim-51caf0a3af599bc4eacdc4b87092bb20286dbfe8.zip
fix(completion): avoid freeing uninitialized value (#33459)
Diffstat (limited to 'test/functional/api/command_spec.lua')
-rw-r--r--test/functional/api/command_spec.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index fabd9be6d6..d332576fb4 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -681,6 +681,19 @@ describe('nvim_create_user_command', function()
eq('Test bbb', fn.getcmdline())
end)
+ it('no crash when Lua complete function errors #33447', function()
+ exec_lua([[
+ vim.api.nvim_create_user_command('Test','', {
+ nargs = 1,
+ complete = function() error() end
+ })
+ ]])
+ feed(':Test <Tab>')
+ eq('E5108: Error executing Lua function: [NULL]', api.nvim_get_vvar('errmsg'))
+ eq('Test ', fn.getcmdline())
+ assert_alive()
+ end)
+
it('does not allow invalid command names', function()
eq(
"Invalid command name (must start with uppercase): 'test'",