summaryrefslogtreecommitdiff
path: root/test/lsp
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-30 23:53:46 +0100
committerw0rp <devw0rp@gmail.com>2017-07-30 23:53:46 +0100
commit79d4935ccf95166838dff4feaf78467bc5f86096 (patch)
tree5e48ebfefb3d8f167bdf7f8b93fcff8471f15725 /test/lsp
parent2c252c0f12868c5bbe9a00bd8bc37b32ae3802c4 (diff)
downloadale-79d4935ccf95166838dff4feaf78467bc5f86096.zip
Cover special LSP initialize response handling with Vader tests
Diffstat (limited to 'test/lsp')
-rw-r--r--test/lsp/test_other_initialize_message_handling.vader66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/lsp/test_other_initialize_message_handling.vader b/test/lsp/test_other_initialize_message_handling.vader
new file mode 100644
index 00000000..3a7c7f62
--- /dev/null
+++ b/test/lsp/test_other_initialize_message_handling.vader
@@ -0,0 +1,66 @@
+Before:
+ let b:project = {
+ \ 'initialized': 0,
+ \ 'init_request_id': 3,
+ \ 'message_queue': [],
+ \}
+
+ let b:conn = {
+ \ 'projects': {
+ \ '/foo/bar': b:project,
+ \ },
+ \}
+
+After:
+ unlet! b:project
+ unlet! b:conn
+
+Execute(publishDiagnostics messages with files inside project directories should initialize projects):
+ " This is for some other file, ignore this one.
+ call ale#lsp#HandleOtherInitializeResponses(b:conn, {
+ \ 'method': 'textDocument/publishDiagnostics',
+ \ 'params': {'uri': 'file:///xyz/bar/baz.txt'},
+ \})
+
+ AssertEqual
+ \ {
+ \ 'initialized': 0,
+ \ 'init_request_id': 3,
+ \ 'message_queue': [],
+ \ },
+ \ b:project
+
+ call ale#lsp#HandleOtherInitializeResponses(b:conn, {
+ \ 'method': 'textDocument/publishDiagnostics',
+ \ 'params': {'uri': 'file:///foo/bar/baz.txt'},
+ \})
+
+ AssertEqual
+ \ {
+ \ 'initialized': 1,
+ \ 'init_request_id': 3,
+ \ 'message_queue': [],
+ \ },
+ \ b:project
+
+Execute(Messages with no method and capabilities should initialize projects):
+ call ale#lsp#HandleOtherInitializeResponses(b:conn, {
+ \ 'result': {'capabilities': {}},
+ \})
+
+ AssertEqual
+ \ {
+ \ 'initialized': 1,
+ \ 'init_request_id': 3,
+ \ 'message_queue': [],
+ \ },
+ \ b:project
+
+Execute(Other messages should not initialize projects):
+ call ale#lsp#HandleOtherInitializeResponses(b:conn, {'method': 'lolwat'})
+
+ AssertEqual 0, b:project.initialized
+
+ call ale#lsp#HandleOtherInitializeResponses(b:conn, {'result': {'x': {}}})
+
+ AssertEqual 0, b:project.initialized