summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lsp/test_lsp_client_messages.vader4
-rw-r--r--test/lsp/test_lsp_connections.vader26
-rw-r--r--test/lsp/test_read_lsp_diagnostics.vader26
-rw-r--r--test/test_loclist_corrections.vader16
4 files changed, 47 insertions, 25 deletions
diff --git a/test/lsp/test_lsp_client_messages.vader b/test/lsp/test_lsp_client_messages.vader
index a967e4ec..5decbf6c 100644
--- a/test/lsp/test_lsp_client_messages.vader
+++ b/test/lsp/test_lsp_client_messages.vader
@@ -127,8 +127,8 @@ Execute(ale#lsp#tsserver_message#Change() should return correct messages):
\ 'file': b:dir . '/foo.ts',
\ 'line': 1,
\ 'offset': 1,
- \ 'endLine': 3,
- \ 'endOffset': 5,
+ \ 'endLine': 1073741824,
+ \ 'endOffset': 1,
\ 'insertString': "foo()\nbar()\nbaz()",
\ }
\ ],
diff --git a/test/lsp/test_lsp_connections.vader b/test/lsp/test_lsp_connections.vader
index 82e3fc64..1faa7a03 100644
--- a/test/lsp/test_lsp_connections.vader
+++ b/test/lsp/test_lsp_connections.vader
@@ -110,55 +110,63 @@ Execute(ale#lsp#CreateMessageData() should create tsserver notification messages
AssertEqual
\ [
\ 0,
- \ '{"seq": null, "type": "request", "command": "someNotification"}',
+ \ '{"seq": null, "type": "request", "command": "someNotification"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([1, 'ts@someNotification'])
AssertEqual
\ [
\ 0,
- \ '{"seq": null, "arguments": {"foo": "bar"}, "type": "request", "command": "someNotification"}',
+ \ '{"seq": null, "arguments": {"foo": "bar"}, "type": "request", "command": "someNotification"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([1, 'ts@someNotification', {'foo': 'bar'}])
else
AssertEqual
\ [
\ 0,
- \ '{"seq":null,"type":"request","command":"someNotification"}',
+ \ '{"seq":null,"type":"request","command":"someNotification"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([1, 'ts@someNotification'])
AssertEqual
\ [
\ 0,
- \ '{"seq":null,"arguments":{"foo":"bar"},"type":"request","command":"someNotification"}',
+ \ '{"seq":null,"arguments":{"foo":"bar"},"type":"request","command":"someNotification"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([1, 'ts@someNotification', {'foo': 'bar'}])
endif
-Execute(ale#lsp#CreateMessageData() should create tsserver messages excepting responses):
+Execute(ale#lsp#CreateMessageData() should create tsserver messages expecting responses):
if has('nvim')
AssertEqual
\ [
\ 1,
- \ '{"seq": 1, "type": "request", "command": "someMessage"}',
+ \ '{"seq": 1, "type": "request", "command": "someMessage"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([0, 'ts@someMessage'])
AssertEqual
\ [
\ 2,
- \ '{"seq": 2, "arguments": {"foo": "bar"}, "type": "request", "command": "someMessage"}',
+ \ '{"seq": 2, "arguments": {"foo": "bar"}, "type": "request", "command": "someMessage"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([0, 'ts@someMessage', {'foo': 'bar'}])
else
AssertEqual
\ [
\ 1,
- \ '{"seq":1,"type":"request","command":"someMessage"}',
+ \ '{"seq":1,"type":"request","command":"someMessage"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([0, 'ts@someMessage'])
AssertEqual
\ [
\ 2,
- \ '{"seq":2,"arguments":{"foo":"bar"},"type":"request","command":"someMessage"}',
+ \ '{"seq":2,"arguments":{"foo":"bar"},"type":"request","command":"someMessage"}'
+ \ . "\n",
\ ],
\ ale#lsp#CreateMessageData([0, 'ts@someMessage', {'foo': 'bar'}])
endif
diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader
index b52da1bd..63086a7f 100644
--- a/test/lsp/test_read_lsp_diagnostics.vader
+++ b/test/lsp/test_read_lsp_diagnostics.vader
@@ -13,7 +13,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle errors):
AssertEqual ['filename.ts', [
\ {
\ 'type': 'E',
- \ 'message': 'Something went wrong!',
+ \ 'text': 'Something went wrong!',
\ 'lnum': 3,
\ 'col': 11,
\ 'end_lnum': 5,
@@ -34,7 +34,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle warnings):
AssertEqual ['filename.ts', [
\ {
\ 'type': 'W',
- \ 'message': 'Something went wrong!',
+ \ 'text': 'Something went wrong!',
\ 'lnum': 2,
\ 'col': 4,
\ 'end_lnum': 2,
@@ -55,7 +55,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should treat messages with missing se
AssertEqual ['filename.ts', [
\ {
\ 'type': 'E',
- \ 'message': 'Something went wrong!',
+ \ 'text': 'Something went wrong!',
\ 'lnum': 3,
\ 'col': 11,
\ 'end_lnum': 5,
@@ -75,7 +75,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle messages without codes)
AssertEqual ['filename.ts', [
\ {
\ 'type': 'E',
- \ 'message': 'Something went wrong!',
+ \ 'text': 'Something went wrong!',
\ 'lnum': 3,
\ 'col': 11,
\ 'end_lnum': 5,
@@ -93,7 +93,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages):
AssertEqual ['filename.ts', [
\ {
\ 'type': 'E',
- \ 'message': 'Something went wrong!',
+ \ 'text': 'Something went wrong!',
\ 'lnum': 1,
\ 'col': 3,
\ 'end_lnum': 1,
@@ -101,7 +101,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages):
\ },
\ {
\ 'type': 'W',
- \ 'message': 'A warning',
+ \ 'text': 'A warning',
\ 'lnum': 2,
\ 'col': 5,
\ 'end_lnum': 2,
@@ -119,3 +119,17 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages):
\ 'message': 'A warning',
\ },
\ ]})
+
+Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle tsserver responses):
+ AssertEqual [
+ \ {
+ \ 'type': 'E',
+ \ 'nr': 2365,
+ \ 'text': 'Operator ''''+'''' cannot be applied to types ''''3'''' and ''''{}''''.',
+ \ 'lnum': 1,
+ \ 'col': 11,
+ \ 'end_lnum': 1,
+ \ 'end_col': 17,
+ \ },
+ \],
+ \ ale#lsp#response#ReadTSServerDiagnostics({"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/bar/foo.ts","diagnostics":[{"start":{"line":1,"offset":11},"end":{"line":1,"offset":17},"text":"Operator ''+'' cannot be applied to types ''3'' and ''{}''.","code":2365}]}})
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index 4e3f543c..e23109ed 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -36,7 +36,7 @@ Execute(FixLocList should set all the default values correctly):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
\ )
@@ -56,7 +56,7 @@ Execute(FixLocList should use the values we supply):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [{
\ 'text': 'a',
\ 'lnum': 3,
@@ -84,7 +84,7 @@ Execute(FixLocList should set items with lines beyond the end to the last line):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [{'text': 'a', 'lnum': 11}],
\ )
@@ -104,7 +104,7 @@ Execute(FixLocList should move line 0 to line 1):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [{'text': 'a', 'lnum': 0}],
\ )
@@ -125,7 +125,7 @@ Execute(FixLocList should convert line and column numbers correctly):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [{'text': 'a', 'lnum': '010', 'col': '010'}],
\ )
@@ -158,7 +158,7 @@ Execute(FixLocList should pass on end_col values):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [
\ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012'},
\ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12},
@@ -195,7 +195,7 @@ Execute(FixLocList should pass on end_lnum values):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [
\ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012', 'end_lnum': '013'},
\ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12, 'end_lnum': 13},
@@ -220,6 +220,6 @@ Execute(FixLocList should allow subtypes to be set):
\],
\ ale#engine#FixLocList(
\ bufnr('%'),
- \ {'name': 'foobar'},
+ \ 'foobar',
\ [{'text': 'a', 'lnum': 11, 'sub_type': 'style'}],
\ )