aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-21 01:52:19 +0300
committerZyX <kp-pav@yandex.ru>2017-03-27 00:12:22 +0300
commit666d85d3ce80c19c9cd2acd156edbf50fd7e8741 (patch)
treeeb585d70ad318c36d34e83dfe1ea7afec64cbc8e /test/functional/lua
parent53b89c1dcf44c95827cc85a9657faee451c573c5 (diff)
downloadrneovim-666d85d3ce80c19c9cd2acd156edbf50fd7e8741.tar.gz
rneovim-666d85d3ce80c19c9cd2acd156edbf50fd7e8741.tar.bz2
rneovim-666d85d3ce80c19c9cd2acd156edbf50fd7e8741.zip
functests: Some more tests
Diffstat (limited to 'test/functional/lua')
-rw-r--r--test/functional/lua/api_spec.lua10
-rw-r--r--test/functional/lua/luaeval_spec.lua7
2 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua
index 31c855c2c1..f6f65cb741 100644
--- a/test/functional/lua/api_spec.lua
+++ b/test/functional/lua/api_spec.lua
@@ -36,6 +36,16 @@ describe('luaeval(vim.api.…)', function()
end)
end)
+ it('correctly evaluates API code which calls luaeval', function()
+ eq(1, funcs.luaeval(([===[vim.api.nvim_eval([==[
+ luaeval('vim.api.nvim_eval([=[
+ luaeval("vim.api.nvim_eval([[
+ luaeval(1)
+ ]])")
+ ]=])')
+ ]==])]===]):gsub('\n', ' ')))
+ end)
+
it('correctly converts from API objects', function()
eq(1, funcs.luaeval('vim.api.nvim_eval("1")'))
eq('1', funcs.luaeval([[vim.api.nvim_eval('"1"')]]))
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua
index 345848cfff..b0169c3d6b 100644
--- a/test/functional/lua/luaeval_spec.lua
+++ b/test/functional/lua/luaeval_spec.lua
@@ -241,4 +241,11 @@ describe('luaeval()', function()
eq('Vim(call):E5108: Error while calling lua chunk for luaeval(): [string "<VimL compiled string>"]:1: ERROR',
exc_exec([[call luaeval("error('ERROR')")]]))
end)
+
+ it('does not leak memory when called with too long line with syntax error',
+ function()
+ local s = ('x'):rep(65536)
+ eq('Vim(call):E5107: Error while creating lua chunk for luaeval(): [string "<VimL compiled string>"]:1: unexpected symbol near \')\'',
+ exc_exec([[call luaeval("(']] .. s ..[[' + )")]]))
+ end)
end)