summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-04-26 21:54:11 +0100
committerw0rp <devw0rp@gmail.com>2018-04-26 21:54:11 +0100
commitd8d09c2048a72a6205bcf1c5069f7016a3a6261e (patch)
treed0ed19abb3431df392c9b0fcfc3120c98acd0372 /test
parente6fe2d86b8bbdcc5a5d27bd4ac30fd30c8cc62ee (diff)
downloadale-d8d09c2048a72a6205bcf1c5069f7016a3a6261e.zip
Close #1428 Implement LSP hover-like functionality for tsserver too
Diffstat (limited to 'test')
-rw-r--r--test/lsp/test_lsp_client_messages.vader13
-rw-r--r--test/test_hover.vader44
2 files changed, 57 insertions, 0 deletions
diff --git a/test/lsp/test_lsp_client_messages.vader b/test/lsp/test_lsp_client_messages.vader
index d186f5e4..89a29c8f 100644
--- a/test/lsp/test_lsp_client_messages.vader
+++ b/test/lsp/test_lsp_client_messages.vader
@@ -275,3 +275,16 @@ Execute(ale#lsp#tsserver_message#References() should return correct messages):
\ }
\ ],
\ ale#lsp#tsserver_message#References(bufnr(''), 347, 12)
+
+Execute(ale#lsp#tsserver_message#Quickinfo() should return correct messages):
+ AssertEqual
+ \ [
+ \ 0,
+ \ 'ts@quickinfo',
+ \ {
+ \ 'file': ale#path#Simplify(g:dir . '/foo/bar.ts'),
+ \ 'line': 347,
+ \ 'offset': 12,
+ \ }
+ \ ],
+ \ ale#lsp#tsserver_message#Quickinfo(bufnr(''), 347, 12)
diff --git a/test/test_hover.vader b/test/test_hover.vader
index 3018249d..18dcebaf 100644
--- a/test/test_hover.vader
+++ b/test/test_hover.vader
@@ -70,6 +70,50 @@ Given python(Some Python file):
somelongerline
bazxyzxyzxyz
+Execute(Other messages for the tsserver handler should be ignored):
+ call ale#hover#HandleTSServerResponse(1, {'command': 'foo'})
+
+Execute(Failed hover responses should be handled correctly):
+ call ale#hover#SetMap({3: {}})
+ call ale#hover#HandleTSServerResponse(
+ \ 1,
+ \ {'command': 'quickinfo', 'request_seq': 3}
+ \)
+ AssertEqual {}, ale#hover#GetMap()
+
+Given typescript(Some typescript file):
+ foo
+ somelongerline
+ bazxyzxyzxyz
+
+Execute(tsserver quickinfo responses will null missing bodies should be handled):
+ call ale#hover#SetMap({3: {}})
+ call ale#hover#HandleTSServerResponse(
+ \ 1,
+ \ {
+ \ 'command': 'quickinfo',
+ \ 'request_seq': 3,
+ \ 'success': v:true,
+ \ }
+ \)
+
+ AssertEqual {}, ale#hover#GetMap()
+
+Execute(tsserver quickinfo displayString values should be displayed):
+ call ale#hover#SetMap({3: {}})
+ call ale#hover#HandleTSServerResponse(
+ \ 1,
+ \ {
+ \ 'command': 'quickinfo',
+ \ 'request_seq': 3,
+ \ 'success': v:true,
+ \ 'body': {'displayString': 'foo bar'},
+ \ }
+ \)
+
+ AssertEqual ['foo bar'], g:echo_list
+ AssertEqual {}, ale#hover#GetMap()
+
Execute(LSP hover responses with just a string should be handled):
call HandleValidLSPResult({'contents': 'foobar'})