2017-10-14 22:22:13 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_enabled
|
|
|
|
|
|
|
|
unlet! b:ale_quitting
|
|
|
|
let g:ale_enabled = 0
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! b:ale_quitting
|
2017-10-16 23:37:29 +00:00
|
|
|
unlet! b:time_before
|
|
|
|
|
|
|
|
Execute(QuitEvent should set b:ale_quitting some time from the clock):
|
|
|
|
let b:time_before = ale#util#ClockMilliseconds()
|
2017-10-14 22:22:13 +00:00
|
|
|
|
|
|
|
call ale#events#QuitEvent(bufnr(''))
|
|
|
|
|
2017-10-16 23:37:29 +00:00
|
|
|
Assert b:ale_quitting >= b:time_before
|
|
|
|
Assert b:ale_quitting <= ale#util#ClockMilliseconds()
|
2017-10-14 22:22:13 +00:00
|
|
|
|
|
|
|
Execute(EnterEvent should set b:ale_quitting to 0):
|
|
|
|
let b:ale_quitting = 1
|
|
|
|
|
|
|
|
call ale#events#EnterEvent(bufnr(''))
|
|
|
|
|
|
|
|
AssertEqual 0, b:ale_quitting
|
2017-10-16 23:37:29 +00:00
|
|
|
|
|
|
|
Execute(The QuitRecently function should work when the variable isn't set):
|
|
|
|
AssertEqual 0, ale#events#QuitRecently(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The QuitRecently function should return 1 when ALE quit recently):
|
|
|
|
let b:ale_quitting = ale#util#ClockMilliseconds()
|
|
|
|
|
|
|
|
AssertEqual 1, ale#events#QuitRecently(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The QuitRecently function should return 0 when a second has passed):
|
|
|
|
let b:ale_quitting = ale#util#ClockMilliseconds() - 1001
|
|
|
|
|
|
|
|
AssertEqual 0, ale#events#QuitRecently(bufnr(''))
|