diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-11-11 09:34:23 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-11-11 09:34:23 +0800 |
commit | a502a7a7311657564065c9d2cd1a64292550722c (patch) | |
tree | f5cf07c02a3e100a655d4ed7043e28657990b297 /test | |
parent | 3b89fee24632cfddbff5714a509c1c3b72a235c5 (diff) | |
download | rneovim-a502a7a7311657564065c9d2cd1a64292550722c.tar.gz rneovim-a502a7a7311657564065c9d2cd1a64292550722c.tar.bz2 rneovim-a502a7a7311657564065c9d2cd1a64292550722c.zip |
fix(channel): fix channels opened by nvim_open_term() never being freed
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/core/channels_spec.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua index e5ded6428f..f93ab0885f 100644 --- a/test/functional/core/channels_spec.lua +++ b/test/functional/core/channels_spec.lua @@ -3,6 +3,8 @@ local uname = helpers.uname local clear, eq, eval, next_msg, ok, source = helpers.clear, helpers.eq, helpers.eval, helpers.next_msg, helpers.ok, helpers.source local command, funcs, meths = helpers.command, helpers.funcs, helpers.meths +local exc_exec = helpers.exc_exec +local poke_eventloop = helpers.poke_eventloop local sleep = helpers.sleep local spawn, nvim_argv = helpers.spawn, helpers.nvim_argv local set_session = helpers.set_session @@ -283,12 +285,14 @@ describe('channels', function() end) it('should throw error when writing to a channel associated with a deleted terminal', function() - source([[ - let id = nvim_open_term(0, {}) - bdelete! - let v:errmsg = '' - silent! call chansend(id, 'test') - ]]) - eq("Can't send data to closed stream", eval('v:errmsg')) + command('let id = nvim_open_term(0, {})') + local err = exc_exec([[bdelete! | call chansend(id, 'test')]]) + -- channel hasn't been freed yet + eq("Vim(call):Can't send data to closed stream", err) + -- process free_channel_event + poke_eventloop() + err = exc_exec([[call chansend(id, 'test')]]) + -- channel has ben freed + eq("Vim(call):E900: Invalid channel id", err) end) end) |