aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/channels_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-13 05:44:50 +0800
committerGitHub <noreply@github.com>2022-03-13 05:44:50 +0800
commit356631cba0e8dc413202f4bc874cb7f204056bae (patch)
tree0570182b73a82a97a04a2d61aa439506c75c4454 /test/functional/core/channels_spec.lua
parent36ca585d2f6b048c518edb9a3003cb7f0ec826ab (diff)
parentf1c9065b0ecfcb8893aaffb00f77ec75e8d2b0d9 (diff)
downloadrneovim-356631cba0e8dc413202f4bc874cb7f204056bae.tar.gz
rneovim-356631cba0e8dc413202f4bc874cb7f204056bae.tar.bz2
rneovim-356631cba0e8dc413202f4bc874cb7f204056bae.zip
Merge pull request #17687 from zeertzjq/fix-channel-consistency
fix(channel): fix channel consistency
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)