mirror of https://github.com/dense-analysis/ale
Re-run history tests, which can fail randomly
This commit is contained in:
parent
d3ed1e52ba
commit
d9e12cb047
|
@ -41,6 +41,7 @@ Before:
|
||||||
After:
|
After:
|
||||||
Restore
|
Restore
|
||||||
|
|
||||||
|
unlet! g:expected_results
|
||||||
unlet! b:ale_fixers
|
unlet! b:ale_fixers
|
||||||
unlet! b:ale_enabled
|
unlet! b:ale_enabled
|
||||||
" Clear the history we changed.
|
" Clear the history we changed.
|
||||||
|
@ -67,16 +68,27 @@ Given foobar (Some imaginary filetype):
|
||||||
Execute(History should be set when commands are run):
|
Execute(History should be set when commands are run):
|
||||||
AssertEqual 'foobar', &filetype
|
AssertEqual 'foobar', &filetype
|
||||||
|
|
||||||
call ale#Lint()
|
let g:expected_results = ['command', 'exit_code', 'job_id', 'status']
|
||||||
call ale#engine#WaitForJobs(2000)
|
|
||||||
|
|
||||||
let g:history = filter(
|
" Retry this test until it works. This one can randomly fail.
|
||||||
\ copy(ale#history#Get(bufnr(''))),
|
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
|
||||||
\ 'v:val.job_id isnot# ''executable''',
|
let b:ale_history = []
|
||||||
\)
|
call ale#Lint()
|
||||||
|
call ale#engine#WaitForJobs(2000)
|
||||||
|
|
||||||
AssertEqual 1, len(g:history)
|
let g:history = filter(
|
||||||
AssertEqual sort(['status', 'exit_code', 'job_id', 'command']), sort(keys(g:history[0]))
|
\ copy(ale#history#Get(bufnr(''))),
|
||||||
|
\ 'v:val.job_id isnot# ''executable''',
|
||||||
|
\)
|
||||||
|
|
||||||
|
AssertEqual 1, len(g:history)
|
||||||
|
|
||||||
|
if sort(keys(g:history[0])) == g:expected_results
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
AssertEqual g:expected_results, sort(keys(g:history[0]))
|
||||||
|
|
||||||
if has('win32')
|
if has('win32')
|
||||||
AssertEqual 'cmd /s/c "echo command history test"', g:history[0].command
|
AssertEqual 'cmd /s/c "echo command history test"', g:history[0].command
|
||||||
|
@ -103,14 +115,24 @@ Execute(History should include command output if logging is enabled):
|
||||||
AssertEqual 'foobar', &filetype
|
AssertEqual 'foobar', &filetype
|
||||||
|
|
||||||
let g:ale_history_log_output = 1
|
let g:ale_history_log_output = 1
|
||||||
|
let g:expected_results = ['command history test']
|
||||||
|
|
||||||
call ale#Lint()
|
" Retry this test until it works. This one can randomly fail.
|
||||||
call ale#engine#WaitForJobs(2000)
|
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
|
||||||
|
let b:ale_history = []
|
||||||
|
call ale#Lint()
|
||||||
|
call ale#engine#WaitForJobs(2000)
|
||||||
|
|
||||||
let g:history = ale#history#Get(bufnr(''))
|
let g:history = ale#history#Get(bufnr(''))
|
||||||
|
|
||||||
AssertEqual 1, len(g:history)
|
AssertEqual 1, len(g:history)
|
||||||
AssertEqual ['command history test'], g:history[0].output
|
|
||||||
|
if get(g:history[0], 'output', []) == g:expected_results
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
AssertEqual g:expected_results, get(g:history[0], 'output', [])
|
||||||
|
|
||||||
Execute(History items should be popped after going over the max):
|
Execute(History items should be popped after going over the max):
|
||||||
let b:ale_history = map(range(20), '{''status'': ''started'', ''job_id'': v:val, ''command'': ''foobar''}')
|
let b:ale_history = map(range(20), '{''status'': ''started'', ''job_id'': v:val, ''command'': ''foobar''}')
|
||||||
|
|
Loading…
Reference in New Issue