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):
|
2018-06-19 19:53:49 +00:00
|
|
|
let b:time_before = ale#events#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
|
2018-06-19 19:53:49 +00:00
|
|
|
Assert b:ale_quitting <= ale#events#ClockMilliseconds()
|
2017-10-14 22:22:13 +00:00
|
|
|
|
2018-07-16 23:18:20 +00:00
|
|
|
Execute(ReadOrEnterEvent should set b:ale_quitting to 0):
|
2017-10-14 22:22:13 +00:00
|
|
|
let b:ale_quitting = 1
|
|
|
|
|
2018-07-16 23:18:20 +00:00
|
|
|
call ale#events#ReadOrEnterEvent(bufnr(''))
|
2017-10-14 22:22:13 +00:00
|
|
|
|
|
|
|
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):
|
2018-06-19 19:53:49 +00:00
|
|
|
let b:ale_quitting = ale#events#ClockMilliseconds()
|
2017-10-16 23:37:29 +00:00
|
|
|
|
|
|
|
AssertEqual 1, ale#events#QuitRecently(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The QuitRecently function should return 0 when a second has passed):
|
2018-06-19 19:53:49 +00:00
|
|
|
let b:ale_quitting = ale#events#ClockMilliseconds() - 1001
|
2017-10-16 23:37:29 +00:00
|
|
|
|
|
|
|
AssertEqual 0, ale#events#QuitRecently(bufnr(''))
|