diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-06 11:18:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-06 11:18:43 +0800 |
commit | ae28ef327e02ac87ef26f941c401312ed0462d8c (patch) | |
tree | dca68db1160d5d8657589298f17b4b5fe5553289 /test/functional/lua/ui_event_spec.lua | |
parent | ddbd2b4e40d0b744d4d5b2b2251a4fc4c51f43e1 (diff) | |
download | rneovim-ae28ef327e02ac87ef26f941c401312ed0462d8c.tar.gz rneovim-ae28ef327e02ac87ef26f941c401312ed0462d8c.tar.bz2 rneovim-ae28ef327e02ac87ef26f941c401312ed0462d8c.zip |
fix: adjust error message for error in UI event callback (#28200)
Also close Nvim instance before removing log file, otherwise the Nvim
instance will still write to the log file.
Also adjust log level in libuv_process_spawn(). Ref #27660
Diffstat (limited to 'test/functional/lua/ui_event_spec.lua')
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 3e46018682..39c51d242c 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -5,6 +5,10 @@ local exec_lua = helpers.exec_lua local clear = helpers.clear local feed = helpers.feed local fn = helpers.fn +local assert_log = helpers.assert_log +local check_close = helpers.check_close + +local testlog = 'Xtest_lua_ui_event_log' describe('vim.ui_attach', function() local screen @@ -150,3 +154,22 @@ describe('vim.ui_attach', function() }, actual, vim.inspect(actual)) end) end) + +describe('vim.ui_attach', function() + after_each(function() + check_close() + os.remove(testlog) + end) + + it('error in callback is logged', function() + clear({ env = { NVIM_LOG_FILE = testlog } }) + local screen = Screen.new() + screen:attach() + exec_lua([[ + local ns = vim.api.nvim_create_namespace('testspace') + vim.ui_attach(ns, { ext_popupmenu = true }, function() error(42) end) + ]]) + feed('ifoo<CR>foobar<CR>fo<C-X><C-N>') + assert_log('Error executing UI event callback: Error executing lua: .*: 42', testlog, 100) + end) +end) |