mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +00:00
executor: Fix some memory leaks
This commit is contained in:
@@ -62,6 +62,15 @@ describe(':lua command', function()
|
||||
eq(NIL, funcs.luaeval('lvar'))
|
||||
eq(42, funcs.luaeval('gvar'))
|
||||
end)
|
||||
it('works with long strings', function()
|
||||
local s = ('x'):rep(100500)
|
||||
|
||||
eq('\nE5104: Error while creating lua chunk: [string "<VimL compiled string>"]:1: unfinished string near \'<eof>\'', redir_exec(('lua vim.api.nvim_buf_set_lines(1, 1, 2, false, {"%s})'):format(s)))
|
||||
eq({''}, curbufmeths.get_lines(0, -1, false))
|
||||
|
||||
eq('', redir_exec(('lua vim.api.nvim_buf_set_lines(1, 1, 2, false, {"%s"})'):format(s)))
|
||||
eq({'', s}, curbufmeths.get_lines(0, -1, false))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe(':luado command', function()
|
||||
@@ -104,6 +113,10 @@ describe(':luado command', function()
|
||||
end)
|
||||
it('works with long strings', function()
|
||||
local s = ('x'):rep(100500)
|
||||
|
||||
eq('\nE5109: Error while creating lua chunk: [string "<VimL compiled string>"]:1: unfinished string near \'<eof>\'', redir_exec(('luado return "%s'):format(s)))
|
||||
eq({''}, curbufmeths.get_lines(0, -1, false))
|
||||
|
||||
eq('', redir_exec(('luado return "%s"'):format(s)))
|
||||
eq({s}, curbufmeths.get_lines(0, -1, false))
|
||||
end)
|
||||
|
||||
@@ -243,10 +243,11 @@ describe('luaeval()', function()
|
||||
exc_exec([[call luaeval("error('ERROR')")]]))
|
||||
end)
|
||||
|
||||
it('does not leak memory when called with too long line with syntax error',
|
||||
it('does not leak memory when called with too long line',
|
||||
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 ..[[' + )")]]))
|
||||
eq(s, funcs.luaeval('"' .. s .. '"'))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user