mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
fix(lua): format errors from luv callbacks using __tostring
This commit is contained in:
@@ -194,4 +194,52 @@ describe('vim.uv', function()
|
||||
feed('<cr>')
|
||||
n.assert_alive()
|
||||
end)
|
||||
|
||||
it("doesn't crash on async callbacks throwing nil error", function()
|
||||
local screen = Screen.new(50, 4)
|
||||
|
||||
exec_lua(function()
|
||||
_G.idle = vim.uv.new_idle()
|
||||
_G.idle:start(function()
|
||||
_G.idle:stop()
|
||||
error()
|
||||
end)
|
||||
end)
|
||||
|
||||
screen:expect([[
|
||||
{3: }|
|
||||
{9:Error executing callback:} |
|
||||
{9:[NULL]} |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
feed('<cr>')
|
||||
|
||||
exec_lua(function()
|
||||
_G.idle:close()
|
||||
end)
|
||||
end)
|
||||
|
||||
it("doesn't crash on async callbacks throwing object as an error", function()
|
||||
local screen = Screen.new(50, 4)
|
||||
|
||||
exec_lua(function()
|
||||
_G.idle = vim.uv.new_idle()
|
||||
_G.idle:start(function()
|
||||
_G.idle:stop()
|
||||
error(_G.idle) -- userdata with __tostring method
|
||||
end)
|
||||
end)
|
||||
|
||||
screen:expect([[
|
||||
{3: }|
|
||||
{9:Error executing callback:} |
|
||||
{9:uv_idle_t: 0x{MATCH:%w+}} |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
feed('<cr>')
|
||||
|
||||
exec_lua(function()
|
||||
_G.idle:close()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user