aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-02 14:37:44 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-09-03 16:14:29 +0200
commit7233433f65e9f3550c72c9932eca390b5437f924 (patch)
treea23a0cc7aef8d830b048bca404f481c5f70ae4ca /test
parent03be64ce2ac1bd941996024a5bd0e3f9fa974445 (diff)
downloadrneovim-7233433f65e9f3550c72c9932eca390b5437f924.tar.gz
rneovim-7233433f65e9f3550c72c9932eca390b5437f924.tar.bz2
rneovim-7233433f65e9f3550c72c9932eca390b5437f924.zip
test/job_spec: improve visibility of flaky test
Test sometimes fails on macOS CI: FAILED test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting test/functional/core/job_spec.lua:606: Expected objects to be the same. Passed in: (table: 0x1be77c80) { [1] = 'notification' [2] = 'wait' *[3] = { *[1] = 3 } } Expected: (table: 0x1be77d10) { [1] = 'notification' [2] = 'wait' *[3] = { *[1] = 4 } } stack traceback: test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583 Change the test to check if all jobs are starting, not only exiting.
Diffstat (limited to 'test')
-rw-r--r--test/functional/core/job_spec.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 73b0a0009d..dec7c1422d 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,11 @@ 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())
+ assert:set_parameter('TableFormatLevel', 1000000)
+ 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()