summaryrefslogtreecommitdiff
path: root/test/test_find_references.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_find_references.vader')
-rw-r--r--test/test_find_references.vader32
1 files changed, 17 insertions, 15 deletions
diff --git a/test/test_find_references.vader b/test/test_find_references.vader
index d31424ef..078333bb 100644
--- a/test/test_find_references.vader
+++ b/test/test_find_references.vader
@@ -11,28 +11,30 @@ Before:
let g:options = {}
let g:capability_checked = ''
let g:conn_id = v:null
- let g:WaitCallback = v:null
+ let g:InitCallback = v:null
runtime autoload/ale/linter.vim
runtime autoload/ale/lsp.vim
runtime autoload/ale/util.vim
runtime autoload/ale/preview.vim
- function! ale#lsp_linter#StartLSP(buffer, linter) abort
+ function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {})
call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer)
-
- return {
+ let l:details = {
\ 'buffer': a:buffer,
\ 'connection_id': g:conn_id,
\ 'project_root': '/foo/bar',
\ 'language_id': 'python',
\}
+
+ let g:InitCallback = {-> a:Callback(a:linter, l:details)}
endfunction
- function! ale#lsp#WaitForCapability(conn_id, capability, callback) abort
+ function! ale#lsp#HasCapability(conn_id, capability) abort
let g:capability_checked = a:capability
- let g:WaitCallback = a:callback
+
+ return 1
endfunction
function! ale#lsp#RegisterCallback(conn_id, callback) abort
@@ -65,7 +67,7 @@ After:
call ale#linter#Reset()
unlet! g:capability_checked
- unlet! g:WaitCallback
+ unlet! g:InitCallback
unlet! g:old_filename
unlet! g:conn_id
unlet! g:Callback
@@ -173,10 +175,10 @@ Execute(tsserver reference requests should be sent):
" We shouldn't register the callback yet.
AssertEqual '''''', string(g:Callback)
- AssertEqual type(function('type')), type(g:WaitCallback)
- AssertEqual 'references', g:capability_checked
- call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
+ AssertEqual type(function('type')), type(g:InitCallback)
+ call g:InitCallback()
+ AssertEqual 'references', g:capability_checked
AssertEqual
\ 'function(''ale#references#HandleTSServerResponse'')',
\ string(g:Callback)
@@ -191,7 +193,7 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleTSServe
ALEFindReferences -relative
- call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
+ call g:InitCallback()
AssertEqual {'42': {'use_relative_paths': 1}}, ale#references#GetMap()
@@ -264,10 +266,10 @@ Execute(LSP reference requests should be sent):
" We shouldn't register the callback yet.
AssertEqual '''''', string(g:Callback)
- AssertEqual type(function('type')), type(g:WaitCallback)
- AssertEqual 'references', g:capability_checked
- call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
+ AssertEqual type(function('type')), type(g:InitCallback)
+ call g:InitCallback()
+ AssertEqual 'references', g:capability_checked
AssertEqual
\ 'function(''ale#references#HandleLSPResponse'')',
\ string(g:Callback)
@@ -298,6 +300,6 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResp
ALEFindReferences -relative
- call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
+ call g:InitCallback()
AssertEqual {'42': {'use_relative_paths': 1}}, ale#references#GetMap()