summaryrefslogtreecommitdiff
path: root/test/lsp/test_other_initialize_message_handling.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-02-15 08:54:53 +0000
committerw0rp <devw0rp@gmail.com>2019-02-15 08:54:53 +0000
commit0d10653a7c780ac98fd2b980679676f5e8f231e7 (patch)
treed8c0ad7b340dd281c725ed3a34e81f398ceec33a /test/lsp/test_other_initialize_message_handling.vader
parent89039187da89467d059cc13135e1b6cd867a68e9 (diff)
downloadale-0d10653a7c780ac98fd2b980679676f5e8f231e7.zip
Fix #2295 - Respond to initialize with an initialized message
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