aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/channels_spec.lua
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2021-11-12 00:07:03 +0900
committerzeertzjq <zeertzjq@outlook.com>2022-03-12 19:23:45 +0800
commit5051510ade5f171c1239906c8638e804356186fe (patch)
tree43ce21d99a58a7c77baf6f98d0c5234070db93e4 /test/functional/core/channels_spec.lua
parentab456bc304965d83585cd248284cb36c96927457 (diff)
downloadrneovim-5051510ade5f171c1239906c8638e804356186fe.tar.gz
rneovim-5051510ade5f171c1239906c8638e804356186fe.tar.bz2
rneovim-5051510ade5f171c1239906c8638e804356186fe.zip
fix(channel): fix channel consistency
- Fix the problem that chanclose() does not work for channel created by nvim_open_term(). - Fix the problem that the loopback channel is not released. - Fix the error message when sending raw data to the loopback channel.
Diffstat (limited to 'test/functional/core/channels_spec.lua')
-rw-r--r--test/functional/core/channels_spec.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua
index c28300f0f4..ca52404d3b 100644
--- a/test/functional/core/channels_spec.lua
+++ b/test/functional/core/channels_spec.lua
@@ -10,6 +10,8 @@ local nvim_prog = helpers.nvim_prog
local is_os = helpers.is_os
local retry = helpers.retry
local expect_twostreams = helpers.expect_twostreams
+local assert_alive = helpers.assert_alive
+local pcall_err = helpers.pcall_err
describe('channels', function()
local init = [[
@@ -314,3 +316,22 @@ describe('channels', function()
eq({"notification", "exit", {id, 1, {''}}}, next_msg())
end)
end)
+
+describe('loopback', function()
+ before_each(function()
+ clear()
+ command("let chan = sockconnect('pipe', v:servername, {'rpc': v:true})")
+ end)
+
+ it('does not crash when sending raw data', function()
+ eq("Vim(call):Can't send raw data to rpc channel",
+ pcall_err(command, "call chansend(chan, 'test')"))
+ assert_alive()
+ end)
+
+ it('are released when closed', function()
+ local chans = eval('len(nvim_list_chans())')
+ command('call chanclose(chan)')
+ eq(chans - 1, eval('len(nvim_list_chans())'))
+ end)
+end)