aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-20 08:08:50 +0800
committerGitHub <noreply@github.com>2022-03-20 08:08:50 +0800
commit77eb6f9dc75ebe00aa835441ad623ba46d7108bb (patch)
tree9a968c1c192ea892f68b23c817fe487dc89df72d /test/functional/api/vim_spec.lua
parent2ab52bd9889790dc7e47a09e801751aada418727 (diff)
downloadrneovim-77eb6f9dc75ebe00aa835441ad623ba46d7108bb.tar.gz
rneovim-77eb6f9dc75ebe00aa835441ad623ba46d7108bb.tar.bz2
rneovim-77eb6f9dc75ebe00aa835441ad623ba46d7108bb.zip
fix(api, lua): return NIL on failure to find converted function (#17779)
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index af6872760a..ed9d915954 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -6,6 +6,7 @@ local assert_alive = helpers.assert_alive
local NIL = helpers.NIL
local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
local command = helpers.command
+local exec = helpers.exec
local eval = helpers.eval
local expect = helpers.expect
local funcs = helpers.funcs
@@ -1271,6 +1272,17 @@ describe('API', function()
eq('Key is locked: lua', pcall_err(meths.del_var, 'lua'))
eq('Key is locked: lua', pcall_err(meths.set_var, 'lua', 1))
+ exec([[
+ function Test()
+ endfunction
+ function s:Test()
+ endfunction
+ let g:Unknown_func = function('Test')
+ let g:Unknown_script_func = function('s:Test')
+ ]])
+ eq(NIL, meths.get_var('Unknown_func'))
+ eq(NIL, meths.get_var('Unknown_script_func'))
+
-- Check if autoload works properly
local pathsep = helpers.get_pathsep()
local xconfig = 'Xhome' .. pathsep .. 'Xconfig'