aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-12-23 15:49:13 +0100
committerGitHub <noreply@github.com>2017-12-23 15:49:13 +0100
commitec86f4215fc58246998c6017df84206153d0df1a (patch)
tree8d48449b2a55b5c1d3c8d80daea30018aa005d6e /test/functional
parentaa951b14893d8a30ec3bad6fb4b7064ccda16d5c (diff)
parent61ba3c5e31bf5bf491046098e4d9922dd6c3c082 (diff)
downloadrneovim-ec86f4215fc58246998c6017df84206153d0df1a.tar.gz
rneovim-ec86f4215fc58246998c6017df84206153d0df1a.tar.bz2
rneovim-ec86f4215fc58246998c6017df84206153d0df1a.zip
Merge #7646 from bfredl/chan_buffered
Document and defer error message when buffered stream would overwrite channels dict key
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/core/channels_spec.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua
index 765e3c5919..e9fc88c01b 100644
--- a/test/functional/core/channels_spec.lua
+++ b/test/functional/core/channels_spec.lua
@@ -246,6 +246,22 @@ describe('channels', function()
eq({"notification", "exit", {id, 0, {'10 PRINT "NVIM"',
'20 GOTO 10', ''}}}, next_msg())
+ -- if dict is reused the new value is not stored,
+ -- but nvim also does not crash
+ command("let id = jobstart(['cat'], g:job_opts)")
+ id = eval("g:id")
+
+ command([[call chansend(id, "cat text\n")]])
+ sleep(10)
+ command("call chanclose(id, 'stdin')")
+
+ -- old value was not overwritten
+ eq({"notification", "exit", {id, 0, {'10 PRINT "NVIM"',
+ '20 GOTO 10', ''}}}, next_msg())
+
+ -- and an error was thrown.
+ eq("E5210: dict key 'stdout' already set for buffered stream in channel "..id, eval('v:errmsg'))
+
-- reset dictionary
source([[
let g:job_opts = {
@@ -261,6 +277,5 @@ describe('channels', function()
-- works correctly with no output
eq({"notification", "exit", {id, 1, {''}}}, next_msg())
-
end)
end)