diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/completion/test_completion_events.vader | 36 | ||||
-rw-r--r-- | test/completion/test_lsp_completion_messages.vader | 6 | ||||
-rw-r--r-- | test/completion/test_omnifunc_completion.vader | 12 | ||||
-rw-r--r-- | test/completion/test_public_completion_api.vader | 21 |
4 files changed, 19 insertions, 56 deletions
diff --git a/test/completion/test_completion_events.vader b/test/completion/test_completion_events.vader index ebdcb5df..6bc0035e 100644 --- a/test/completion/test_completion_events.vader +++ b/test/completion/test_completion_events.vader @@ -57,8 +57,6 @@ After: unlet! b:ale_old_omnifunc unlet! b:ale_old_completeopt unlet! b:ale_completion_info - unlet! b:ale_completion_response - unlet! b:ale_completion_parser unlet! b:ale_completion_result unlet! b:ale_complete_done_time @@ -136,7 +134,7 @@ Execute(ale#completion#Show() should remember the omnifunc setting and replace i let &l:omnifunc = 'FooBar' let b:ale_completion_info = {'source': 'ale-automatic'} - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) AssertEqual 'FooBar', b:ale_old_omnifunc AssertEqual 'ale#completion#AutomaticOmniFunc', &l:omnifunc @@ -149,7 +147,7 @@ Execute(ale#completion#Show() should remember the completeopt setting and replac let &l:completeopt = 'menu' let b:ale_completion_info = {'source': 'ale-automatic'} - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) AssertEqual 'menu', b:ale_old_completeopt AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt @@ -162,7 +160,7 @@ Execute(ale#completion#Show() should set the preview option if it's set): let &l:completeopt = 'menu,preview' let b:ale_completion_info = {'source': 'ale-automatic'} - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) AssertEqual 'menu,preview', b:ale_old_completeopt AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt @@ -176,7 +174,7 @@ Execute(ale#completion#Show() should not replace the completeopt setting for man let &l:completeopt = 'menu,preview' - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) Assert !exists('b:ale_old_completeopt') @@ -204,7 +202,7 @@ Execute(ale#completion#AutomaticOmniFunc() should set the preview option if it's Execute(ale#completion#Show() should make the correct feedkeys() call for automatic completion): let b:ale_completion_info = {'source': 'ale-automatic'} - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) AssertEqual [], g:feedkeys_calls sleep 1ms @@ -212,7 +210,7 @@ Execute(ale#completion#Show() should make the correct feedkeys() call for automa Execute(ale#completion#Show() should make the correct feedkeys() call for manual completion): let b:ale_completion_info = {'source': 'ale-automatic'} - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) AssertEqual [], g:feedkeys_calls sleep 1ms @@ -220,7 +218,7 @@ Execute(ale#completion#Show() should make the correct feedkeys() call for manual Execute(ale#completion#Show() should not call feedkeys() for other sources): let b:ale_completion_info = {'source': 'deoplete'} - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) sleep 1ms AssertEqual [], g:feedkeys_calls @@ -229,20 +227,22 @@ Execute(ale#completion#Show() shouldn't do anything if you switch back to normal let &l:completeopt = 'menu,preview' let g:fake_mode = 'n' - call ale#completion#Show('Response', 'Parser') + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) AssertEqual 'menu,preview', &l:completeopt Assert !exists('b:ale_old_omnifunc') Assert !exists('b:ale_old_completeopt') - Assert !exists('b:ale_completion_response') - Assert !exists('b:ale_completion_parser') + Assert !exists('b:ale_completion_result') AssertEqual [], g:feedkeys_calls -Execute(ale#completion#Show() should set up the response and parser): - call ale#completion#Show('Response', 'Parser') +Execute(ale#completion#Show() should save the result it is given): + call ale#completion#Show([]) + + AssertEqual [], b:ale_completion_result + + call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}]) - AssertEqual 'Response', b:ale_completion_response - AssertEqual 'Parser', b:ale_completion_parser + AssertEqual [{'word': 'x', 'kind': 'v', 'icase': 1}], b:ale_completion_result Execute(ale#completion#Done() should restore old omnifunc values): let b:ale_old_omnifunc = 'FooBar' @@ -317,8 +317,6 @@ Execute(b:ale_completion_info should be set up correctly when requesting complet Execute(b:ale_completion_info should be set up correctly for other sources): let b:ale_completion_result = [] - let b:ale_completion_response = [] - let b:ale_completion_parser = 'type' call setpos('.', [bufnr(''), 3, 14, 0]) call ale#completion#GetCompletions('deoplete') @@ -334,8 +332,6 @@ Execute(b:ale_completion_info should be set up correctly for other sources): \ }, \ b:ale_completion_info Assert !exists('b:ale_completion_result') - Assert !exists('b:ale_completion_response') - Assert !exists('b:ale_completion_parser') Execute(The correct keybinds should be configured): redir => g:output diff --git a/test/completion/test_lsp_completion_messages.vader b/test/completion/test_lsp_completion_messages.vader index 25536436..9598e5f0 100644 --- a/test/completion/test_lsp_completion_messages.vader +++ b/test/completion/test_lsp_completion_messages.vader @@ -69,8 +69,6 @@ After: unlet! b:ale_old_omnifunc unlet! b:ale_old_completeopt unlet! b:ale_completion_info - unlet! b:ale_completion_response - unlet! b:ale_completion_parser unlet! b:ale_complete_done_time unlet! b:ale_linters unlet! b:ale_tsserver_completion_names @@ -246,14 +244,14 @@ Execute(Two completion requests shouldn't be sent in a row): \ 'lsp': 'stdio', \ 'executable': 'foo', \ 'command': 'foo', - \ 'project_root_callback': {-> '/foo/bar'}, + \ 'project_root': {-> '/foo/bar'}, \}) call ale#linter#Define('python', { \ 'name': 'bar', \ 'lsp': 'stdio', \ 'executable': 'foo', \ 'command': 'foo', - \ 'project_root_callback': {-> '/foo/bar'}, + \ 'project_root': {-> '/foo/bar'}, \}) let b:ale_linters = ['foo', 'bar'] diff --git a/test/completion/test_omnifunc_completion.vader b/test/completion/test_omnifunc_completion.vader index 221d337f..3711f974 100644 --- a/test/completion/test_omnifunc_completion.vader +++ b/test/completion/test_omnifunc_completion.vader @@ -1,7 +1,5 @@ Before: unlet! b:ale_completion_info - unlet! b:ale_completion_response - unlet! b:ale_completion_parser unlet! b:ale_completion_result let b:lsp_started = 0 @@ -12,27 +10,19 @@ Before: return b:lsp_started endfunction - function! Identity(x) abort - return a:x - endfunction - function! SetCompletionResult(...) abort let b:ale_completion_result = ['foo'] endfunction function! SetCompletionResponse(...) abort - let b:ale_completion_response = ['foo'] - let b:ale_completion_parser = 'Identity' + let b:ale_completion_result = ['foo'] endfunction After: unlet! b:ale_completion_info - unlet! b:ale_completion_response - unlet! b:ale_completion_parser unlet! b:ale_completion_result unlet! b:lsp_started - delfunction Identity delfunction SetCompletionResult delfunction SetCompletionResponse diff --git a/test/completion/test_public_completion_api.vader b/test/completion/test_public_completion_api.vader index d4db2d6f..befbb436 100644 --- a/test/completion/test_public_completion_api.vader +++ b/test/completion/test_public_completion_api.vader @@ -3,42 +3,21 @@ Before: unlet! b:ale_linters unlet! b:ale_completion_info - unlet! b:ale_completion_response - unlet! b:ale_completion_parser unlet! b:ale_completion_result - function! Identity(x) abort - return a:x - endfunction - After: - delfunction Identity - call ale#linter#Reset() unlet! b:ale_linters unlet! b:ale_completion_info - unlet! b:ale_completion_response - unlet! b:ale_completion_parser unlet! b:ale_completion_result Execute(ale#completion#GetCompletionResult() should return v:null when there are no results): AssertEqual v:null, ale#completion#GetCompletionResult() -Execute(ale#completion#GetCompletionResult() should parse the result when it has yet to be parsed): - let b:ale_completion_response = [1] - let b:ale_completion_parser = 'Identity' - - AssertEqual [1], ale#completion#GetCompletionResult() - Assert !exists('b:ale_completion_response') - Assert !exists('b:ale_completion_parser') - AssertEqual [1], b:ale_completion_result - Execute(ale#completion#GetCompletionResult() should return a result computed previously): let b:ale_completion_result = [1] - Assert !exists('b:ale_completion_response') - Assert !exists('b:ale_completion_parser') AssertEqual [1], ale#completion#GetCompletionResult() Execute(ale#completion#GetCompletionPosition() should return 0 when there is no completion information): |