aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-03 08:40:54 -0700
committerGitHub <noreply@github.com>2019-09-03 08:40:54 -0700
commitb8f2436febcc5d68e572d3703a21368e69ac1cb8 (patch)
tree6201ec88d4242a1dd4f57defc036293eb7bf3d7d /test/functional/core
parent03be64ce2ac1bd941996024a5bd0e3f9fa974445 (diff)
parent6242bac90461afb659c5536f9efa8e84775e9df2 (diff)
downloadrneovim-b8f2436febcc5d68e572d3703a21368e69ac1cb8.tar.gz
rneovim-b8f2436febcc5d68e572d3703a21368e69ac1cb8.tar.bz2
rneovim-b8f2436febcc5d68e572d3703a21368e69ac1cb8.zip
Merge #10915 'jobwait(): fix race if job exits quickly'
Diffstat (limited to 'test/functional/core')
-rw-r--r--test/functional/core/job_spec.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 73b0a0009d..3a1be7bc52 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -582,13 +582,17 @@ describe('jobs', function()
it('will run callbacks while waiting', function()
source([[
- let g:dict = {'id': 10}
- let g:exits = 0
- function g:dict.on_exit(id, code, event)
+ let g:dict = {}
+ let g:jobs = []
+ let g:exits = []
+ function g:dict.on_stdout(id, code, event) abort
+ call add(g:jobs, a:id)
+ endfunction
+ function g:dict.on_exit(id, code, event) abort
if a:code != 5
throw 'Error!'
endif
- let g:exits += 1
+ call add(g:exits, a:id)
endfunction
call jobwait(has('win32') ? [
\ jobstart('Start-Sleep -Milliseconds 100; exit 5', g:dict),
@@ -601,9 +605,10 @@ describe('jobs', function()
\ jobstart('sleep 0.050; exit 5', g:dict),
\ jobstart('sleep 0.070; exit 5', g:dict)
\ ])
- call rpcnotify(g:channel, 'wait', g:exits)
+ call rpcnotify(g:channel, 'wait', sort(g:jobs), sort(g:exits))
]])
- eq({'notification', 'wait', {4}}, next_msg())
+ eq({'notification', 'wait',
+ {{3,4,5,6}, {3,4,5,6}}}, next_msg())
end)
it('will return status codes in the order of passed ids', function()