diff options
author | w0rp <devw0rp@gmail.com> | 2017-06-08 17:28:38 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-06-09 09:47:19 +0100 |
commit | 51463322066a1d1bf3537b31e7b330861e0cf283 (patch) | |
tree | abfde136e621dab2e36ab39164be061fcf3c8b3b /test/lsp | |
parent | 64ad51048d8f490b57ca6e74864f4de3777ec2a7 (diff) | |
download | ale-51463322066a1d1bf3537b31e7b330861e0cf283.zip |
Add tsserver support
Diffstat (limited to 'test/lsp')
-rw-r--r-- | test/lsp/test_lsp_client_messages.vader | 6 | ||||
-rw-r--r-- | test/lsp/test_lsp_connections.vader | 26 | ||||
-rw-r--r-- | test/lsp/test_read_lsp_diagnostics.vader | 26 |
3 files changed, 40 insertions, 18 deletions
diff --git a/test/lsp/test_lsp_client_messages.vader b/test/lsp/test_lsp_client_messages.vader index a967e4ec..75f5826a 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()", \ } \ ], @@ -139,7 +139,7 @@ Execute(ale#lsp#tsserver_message#Geterr() should return correct messages): AssertEqual \ [ - \ 1, + \ 0, \ 'ts@geterr', \ { \ 'files': [b:dir . '/foo.ts'], 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}]}}) |