aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/luaeval_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/lua/luaeval_spec.lua')
-rw-r--r--test/functional/lua/luaeval_spec.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index 0675ec9abd..c543dd1995 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen')
local pcall_err = helpers.pcall_err
local exc_exec = helpers.exc_exec
+local remove_trace = helpers.remove_trace
local exec_lua = helpers.exec_lua
local command = helpers.command
local meths = helpers.meths
@@ -424,11 +425,11 @@ describe('luaeval()', function()
it('errors out correctly when doing incorrect things in lua', function()
-- Conversion errors
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)',
- exc_exec([[call luaeval("vim.xxx_nonexistent_key_xxx()")]]))
+ remove_trace(exc_exec([[call luaeval("vim.xxx_nonexistent_key_xxx()")]])))
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: ERROR',
- exc_exec([[call luaeval("error('ERROR')")]]))
+ remove_trace(exc_exec([[call luaeval("error('ERROR')")]])))
eq('Vim(call):E5108: Error executing lua [NULL]',
- exc_exec([[call luaeval("error(nil)")]]))
+ remove_trace(exc_exec([[call luaeval("error(nil)")]])))
end)
it('does not leak memory when called with too long line',
@@ -527,6 +528,12 @@ describe('v:lua', function()
]]}
end)
+ it('supports packages', function()
+ command('set pp+=test/functional/fixtures')
+ eq('\tbadval', eval("v:lua.require'leftpad'('badval')"))
+ eq(9003, eval("v:lua.require'bar'.doit()"))
+ end)
+
it('throw errors for invalid use', function()
eq('Vim(let):E15: Invalid expression: v:lua.func', pcall_err(command, "let g:Func = v:lua.func"))
eq('Vim(let):E15: Invalid expression: v:lua', pcall_err(command, "let g:Func = v:lua"))