mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00:00
functests: Some more tests
This commit is contained in:
@@ -36,6 +36,16 @@ describe('luaeval(vim.api.…)', function()
|
|||||||
end)
|
end)
|
||||||
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()
|
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")'))
|
||||||
eq('1', funcs.luaeval([[vim.api.nvim_eval('"1"')]]))
|
eq('1', funcs.luaeval([[vim.api.nvim_eval('"1"')]]))
|
||||||
|
@@ -241,4 +241,11 @@ describe('luaeval()', function()
|
|||||||
eq('Vim(call):E5108: Error while calling lua chunk for luaeval(): [string "<VimL compiled string>"]:1: ERROR',
|
eq('Vim(call):E5108: Error while calling lua chunk for luaeval(): [string "<VimL compiled string>"]:1: ERROR',
|
||||||
exc_exec([[call luaeval("error('ERROR')")]]))
|
exc_exec([[call luaeval("error('ERROR')")]]))
|
||||||
end)
|
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)
|
end)
|
||||||
|
Reference in New Issue
Block a user