mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: api: Do not truncate errors <1 MB.
This commit is contained in:
parent
1fe8945748
commit
4524053874
@ -412,7 +412,7 @@ describe('api', function()
|
|||||||
eq(5, meths.get_var('avar'))
|
eq(5, meths.get_var('avar'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('throws error on malformated arguments', function()
|
it('throws error on malformed arguments', function()
|
||||||
local req = {
|
local req = {
|
||||||
{'nvim_set_var', {'avar', 1}},
|
{'nvim_set_var', {'avar', 1}},
|
||||||
{'nvim_set_var'},
|
{'nvim_set_var'},
|
||||||
@ -452,6 +452,13 @@ describe('api', function()
|
|||||||
ok(err:match('Invalid option name') ~= nil)
|
ok(err:match('Invalid option name') ~= nil)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not truncate error message <1 MB #5984', function()
|
||||||
|
local very_long_name = 'A'..('x'):rep(10000)..'Z'
|
||||||
|
local status, err = pcall(nvim, 'get_option', very_long_name)
|
||||||
|
eq(false, status)
|
||||||
|
eq(very_long_name, err:match('Ax+Z?'))
|
||||||
|
end)
|
||||||
|
|
||||||
it("doesn't leak memory on incorrect argument types", function()
|
it("doesn't leak memory on incorrect argument types", function()
|
||||||
local status, err = pcall(nvim, 'set_current_dir',{'not', 'a', 'dir'})
|
local status, err = pcall(nvim, 'set_current_dir',{'not', 'a', 'dir'})
|
||||||
eq(false, status)
|
eq(false, status)
|
||||||
|
@ -312,12 +312,13 @@ function Screen:_redraw(updates)
|
|||||||
-- print(require('inspect')(update))
|
-- print(require('inspect')(update))
|
||||||
local method = update[1]
|
local method = update[1]
|
||||||
for i = 2, #update do
|
for i = 2, #update do
|
||||||
local handler = self['_handle_'..method]
|
local handler_name = '_handle_'..method
|
||||||
|
local handler = self[handler_name]
|
||||||
if handler ~= nil then
|
if handler ~= nil then
|
||||||
handler(self, unpack(update[i]))
|
handler(self, unpack(update[i]))
|
||||||
else
|
else
|
||||||
assert(self._on_event,
|
assert(self._on_event,
|
||||||
"Add Screen:_handle_XXX method or call Screen:set_on_event_handler")
|
"Add Screen:"..handler_name.." or call Screen:set_on_event_handler")
|
||||||
self._on_event(method, update[i])
|
self._on_event(method, update[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user