diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-12-01 16:44:36 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2018-12-03 10:42:00 +0100 |
commit | 8b42249cddf6b257e2eee808a41f3d6dd5af6846 (patch) | |
tree | 72de67ecda2504f44f5183daaddb60809e855415 /test/functional/api/vim_spec.lua | |
parent | 07ad5d71ab97a84dc9c59b3507bf7898040d24cf (diff) | |
download | rneovim-8b42249cddf6b257e2eee808a41f3d6dd5af6846.tar.gz rneovim-8b42249cddf6b257e2eee808a41f3d6dd5af6846.tar.bz2 rneovim-8b42249cddf6b257e2eee808a41f3d6dd5af6846.zip |
RPC: turn errors from async calls into notifications
Previously, nvim sent a response with invalid request id (UINT64_MAX).
In functionaltests, catch unexpected error notifications in after_each().
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 6261458f2a..ddf5575e31 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -14,6 +14,7 @@ local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed local os_name = helpers.os_name local request = helpers.request local source = helpers.source +local next_msg = helpers.next_msg local expect_err = global_helpers.expect_err local format_string = global_helpers.format_string @@ -46,6 +47,15 @@ describe('API', function() request, nil) end) + it('handles errors in async requests', function() + local error_types = meths.get_api_info()[2].error_types + nvim_async("bogus") + eq({'notification', 'nvim_error_event', + {error_types.Exception.id, 'Invalid method: nvim_bogus'}}, next_msg()) + -- error didn't close channel. + eq(2, eval('1+1')) + end) + describe('nvim_command', function() it('works', function() local fname = helpers.tmpname() |