aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-05-13 15:07:10 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-05-17 19:09:32 +0200
commita676c658cc7aaba25321d3f3dd5d3374d7044414 (patch)
treef40a41f9247c9532f09e1aaecba5f2f3357335c0 /test
parente121b1dbe78cdf7ad46f493ca3a1cb83c190f719 (diff)
downloadrneovim-a676c658cc7aaba25321d3f3dd5d3374d7044414.tar.gz
rneovim-a676c658cc7aaba25321d3f3dd5d3374d7044414.tar.bz2
rneovim-a676c658cc7aaba25321d3f3dd5d3374d7044414.zip
channel: avoid references to non-rooted vimL list with output
likely fixes #7768 #7913 If multiple internal stream callbacks were recieved before vimL callbacks got called, only invoke one vimL callback with all data.
Diffstat (limited to 'test')
-rw-r--r--test/functional/core/job_spec.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index e90339b0cd..4a21444ee0 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -433,9 +433,25 @@ describe('jobs', function()
let cmd = ['sh', '-c', 'for i in $(seq 1 5); do echo $i; sleep 0.1; done']
endif
call jobwait([jobstart(cmd, d)])
- call rpcnotify(g:channel, 'data', d.data)
]])
- eq({'notification', 'data', {{{'1', ''}, {'2', ''}, {'3', ''}, {'4', ''}, {'5', ''}, {''}}}}, next_msg())
+
+ local expected = {'1', '2', '3', '4', '5', ''}
+ local chunks = eval('d.data')
+ local received = {''}
+ for i, chunk in ipairs(chunks) do
+ if i < #chunks then
+ -- if chunks got joined, a spurious [''] callback was not sent
+ neq({''}, chunk)
+ else
+ -- but EOF callback is still sent
+ eq({''}, chunk)
+ end
+ received[#received] = received[#received]..chunk[1]
+ for j = 2, #chunk do
+ received[#received+1] = chunk[j]
+ end
+ end
+ eq(expected, received)
end)
it('jobstart() works with partial functions', function()