summaryrefslogtreecommitdiff
path: root/test/lsp/test_other_initialize_message_handling.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/lsp/test_other_initialize_message_handling.vader')
-rw-r--r--test/lsp/test_other_initialize_message_handling.vader19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lsp/test_other_initialize_message_handling.vader b/test/lsp/test_other_initialize_message_handling.vader
index 8ae63e91..4150b9d7 100644
--- a/test/lsp/test_other_initialize_message_handling.vader
+++ b/test/lsp/test_other_initialize_message_handling.vader
@@ -1,5 +1,9 @@
Before:
+ runtime autoload/ale/lsp.vim
+
+ let g:message_list = []
let b:conn = {
+ \ 'id': 1,
\ 'is_tsserver': 0,
\ 'data': '',
\ 'root': '/foo/bar',
@@ -21,8 +25,17 @@ Before:
\ },
\}
+ function! ale#lsp#Send(conn_id, message) abort
+ call add(g:message_list, a:message)
+
+ return 42
+ endfunction
+
After:
unlet! b:conn
+ unlet! g:message_list
+
+ runtime autoload/ale/lsp.vim
Execute(Messages with no method and capabilities should initialize projects):
call ale#lsp#HandleInitResponse(b:conn, {
@@ -30,15 +43,18 @@ Execute(Messages with no method and capabilities should initialize projects):
\})
AssertEqual 1, b:conn.initialized
+ AssertEqual [[1, 'initialized']], g:message_list
Execute(Other messages should not initialize projects):
call ale#lsp#HandleInitResponse(b:conn, {'method': 'lolwat'})
AssertEqual 0, b:conn.initialized
+ AssertEqual [], g:message_list
call ale#lsp#HandleInitResponse(b:conn, {'result': {'x': {}}})
AssertEqual 0, b:conn.initialized
+ AssertEqual [], g:message_list
Execute(Capabilities should bet set up correctly):
call ale#lsp#HandleInitResponse(b:conn, {
@@ -86,6 +102,7 @@ Execute(Capabilities should bet set up correctly):
\ 'symbol_search': 1,
\ },
\ b:conn.capabilities
+ AssertEqual [[1, 'initialized']], g:message_list
Execute(Disabled capabilities should be recognised correctly):
call ale#lsp#HandleInitResponse(b:conn, {
@@ -128,6 +145,7 @@ Execute(Disabled capabilities should be recognised correctly):
\ 'symbol_search': 0,
\ },
\ b:conn.capabilities
+ AssertEqual [[1, 'initialized']], g:message_list
Execute(Results that are not dictionaries should be handled correctly):
call ale#lsp#HandleInitResponse(b:conn, {
@@ -135,3 +153,4 @@ Execute(Results that are not dictionaries should be handled correctly):
\ 'id': 1,
\ 'result': v:null,
\})
+ AssertEqual [], g:message_list