summaryrefslogtreecommitdiff
path: root/test/completion/test_complete_events.vader
blob: cee15985f4d158b910e1bde9f1c91374207b4d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Before:
  let g:complete_post_triggered = 0

  augroup VaderTest
    autocmd!
    autocmd User ALECompletePost let g:complete_post_triggered = 1
  augroup END

After:
  unlet! b:ale_completion_info
  unlet! g:complete_post_triggered

  augroup VaderTest
    autocmd!
  augroup END

  augroup! VaderTest

Execute(ALECompletePost should not be triggered when completion is cancelled):
  call ale#completion#HandleUserData({})

  Assert !g:complete_post_triggered

Execute(ALECompletePost should not be triggered when tools other than ALE insert completions):
  call ale#completion#HandleUserData({'user_data': ''})
  call ale#completion#HandleUserData({'user_data': '{}'})

  Assert !g:complete_post_triggered

Execute(ALECompletePost should be triggered when ALE inserts completions):
  call ale#completion#HandleUserData({
  \ 'user_data': json_encode({'_ale_completion_item': 1}),
  \})

  Assert g:complete_post_triggered