summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/completion/test_completion_events.vader28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/completion/test_completion_events.vader b/test/completion/test_completion_events.vader
index 6bc0035e..5672f8e5 100644
--- a/test/completion/test_completion_events.vader
+++ b/test/completion/test_completion_events.vader
@@ -62,6 +62,10 @@ After:
delfunction CheckCompletionCalled
+ if exists('*CompleteCallback')
+ delfunction CompleteCallback
+ endif
+
" Stop any timers we left behind.
" This stops the tests from failing randomly.
call ale#completion#StopTimer()
@@ -333,6 +337,30 @@ Execute(b:ale_completion_info should be set up correctly for other sources):
\ b:ale_completion_info
Assert !exists('b:ale_completion_result')
+Execute(b:ale_completion_info should be set up correctly when requesting completions via callback):
+ let b:ale_completion_result = []
+ call setpos('.', [bufnr(''), 3, 14, 0])
+
+ function! CompleteCallback() abort
+ echo 'Called'
+ endfunction
+
+
+ call ale#completion#GetCompletions('ale-callback', {'callback': funcref('CompleteCallback')})
+
+ AssertEqual
+ \ {
+ \ 'request_id': 0,
+ \ 'conn_id': 0,
+ \ 'column': 14,
+ \ 'line_length': 14,
+ \ 'line': 3,
+ \ 'prefix': 'ab',
+ \ 'source': 'ale-callback',
+ \ },
+ \ b:ale_completion_info
+ Assert !exists('b:ale_completion_result')
+
Execute(The correct keybinds should be configured):
redir => g:output
silent map <Plug>(ale_show_completion_menu)