mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #10920 from bfredl/asyncfail
api: make try_end clean-up after an exception properly.
This commit is contained in:
commit
6434a0bf99
@ -125,6 +125,7 @@ bool try_end(Error *err)
|
|||||||
|
|
||||||
// Set by emsg(), affects aborting(). See also enter_cleanup().
|
// Set by emsg(), affects aborting(). See also enter_cleanup().
|
||||||
did_emsg = false;
|
did_emsg = false;
|
||||||
|
force_abort = false;
|
||||||
|
|
||||||
if (got_int) {
|
if (got_int) {
|
||||||
if (current_exception) {
|
if (current_exception) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
-- Test suite for testing interactions with API bindings
|
-- Test suite for testing interactions with API bindings
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
@ -160,6 +161,37 @@ describe('lua function', function()
|
|||||||
|
|
||||||
feed("<cr>")
|
feed("<cr>")
|
||||||
eq('Error executing vim.schedule lua callback: [string "<nvim>"]:2: big failure\nvery async', eval("v:errmsg"))
|
eq('Error executing vim.schedule lua callback: [string "<nvim>"]:2: big failure\nvery async', eval("v:errmsg"))
|
||||||
|
|
||||||
|
local screen = Screen.new(60,5)
|
||||||
|
screen:set_default_attr_ids({
|
||||||
|
[1] = {bold = true, foreground = Screen.colors.Blue1},
|
||||||
|
[2] = {bold = true, reverse = true},
|
||||||
|
[3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||||
|
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
|
})
|
||||||
|
screen:attach()
|
||||||
|
screen:expect{grid=[[
|
||||||
|
^ |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
-- nvim_command causes a vimL exception, check that it is properly caught
|
||||||
|
-- and propagated as an error message in async contexts.. #10809
|
||||||
|
exec_lua([[
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_command(":echo 'err")
|
||||||
|
end)
|
||||||
|
]])
|
||||||
|
screen:expect{grid=[[
|
||||||
|
|
|
||||||
|
{2: }|
|
||||||
|
{3:Error executing vim.schedule lua callback: [string "<nvim>"]}|
|
||||||
|
{3::2: Vim(echo):E115: Missing quote: 'err} |
|
||||||
|
{4:Press ENTER or type command to continue}^ |
|
||||||
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("vim.split", function()
|
it("vim.split", function()
|
||||||
|
Loading…
Reference in New Issue
Block a user