mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
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.
This commit is contained in:
@@ -582,13 +582,17 @@ describe('jobs', function()
|
|||||||
|
|
||||||
it('will run callbacks while waiting', function()
|
it('will run callbacks while waiting', function()
|
||||||
source([[
|
source([[
|
||||||
let g:dict = {'id': 10}
|
let g:dict = {}
|
||||||
let g:exits = 0
|
let g:jobs = []
|
||||||
function g:dict.on_exit(id, code, event)
|
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
|
if a:code != 5
|
||||||
throw 'Error!'
|
throw 'Error!'
|
||||||
endif
|
endif
|
||||||
let g:exits += 1
|
call add(g:exits, a:id)
|
||||||
endfunction
|
endfunction
|
||||||
call jobwait(has('win32') ? [
|
call jobwait(has('win32') ? [
|
||||||
\ jobstart('Start-Sleep -Milliseconds 100; exit 5', g:dict),
|
\ 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.050; exit 5', g:dict),
|
||||||
\ jobstart('sleep 0.070; 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)
|
end)
|
||||||
|
|
||||||
it('will return status codes in the order of passed ids', function()
|
it('will return status codes in the order of passed ids', function()
|
||||||
|
Reference in New Issue
Block a user