summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_flake8_command_callback.vader27
-rw-r--r--test/command_callback/test_php_langserver_callbacks.vader3
-rw-r--r--test/command_callback/test_rust_rls_callbacks.vader3
-rw-r--r--test/lsp/test_lsp_client_messages.vader13
-rw-r--r--test/test_hover.vader44
-rw-r--r--test/test_linter_defintion_processing.vader24
6 files changed, 99 insertions, 15 deletions
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index 1784b81f..6297bd3f 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -33,20 +33,23 @@ Execute(The flake8 callbacks should return the correct default values):
\ ale#Escape('flake8') . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
" Try with older versions.
call ale#semver#ResetVersionCache()
AssertEqual
- \ ale#Escape('flake8') . ' --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
Execute(The flake8 command callback should let you set options):
let g:ale_python_flake8_options = '--some-option'
AssertEqual
- \ ale#Escape('flake8')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8')
\ . ' --some-option --format=default'
\ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.4'])
@@ -54,7 +57,8 @@ Execute(The flake8 command callback should let you set options):
call ale#semver#ResetVersionCache()
AssertEqual
- \ ale#Escape('flake8')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8')
\ . ' --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
@@ -68,7 +72,8 @@ Execute(You should be able to set a custom executable and it should be escaped):
\ ale#Escape('executable with spaces') . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('executable with spaces')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('executable with spaces')
\ . ' --format=default'
\ . ' --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
@@ -87,7 +92,8 @@ Execute(The flake8 callbacks should detect virtualenv directories):
\ ale#Escape(b:executable) . ' --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape(b:executable)
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape(b:executable)
\ . ' --format=default --stdin-display-name %s -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
@@ -140,7 +146,8 @@ Execute(Using `python -m flake8` should be supported for running flake8):
\ ale#Escape('python') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('python') . ' -m flake8 --some-option --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('python') . ' -m flake8 --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
call ale#semver#ResetVersionCache()
@@ -155,7 +162,8 @@ Execute(Using `python -m flake8` should be supported for running flake8):
\ ale#Escape('python') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('python') . ' -m flake8 --some-option --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('python') . ' -m flake8 --some-option --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
Execute(Using `python2 -m flake8` should be supported with the old args option):
@@ -177,5 +185,6 @@ Execute(Using `python2 -m flake8` should be supported with the old args option):
\ ale#Escape('python2') . ' -m flake8 --version',
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
AssertEqual
- \ ale#Escape('python2') . ' -m flake8 --format=default -',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('python2') . ' -m flake8 --format=default -',
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
diff --git a/test/command_callback/test_php_langserver_callbacks.vader b/test/command_callback/test_php_langserver_callbacks.vader
index 0dc30630..ebcae0e7 100644
--- a/test/command_callback/test_php_langserver_callbacks.vader
+++ b/test/command_callback/test_php_langserver_callbacks.vader
@@ -42,9 +42,6 @@ Execute(Vendor executables should be detected):
\ )),
\ ale_linters#php#langserver#GetCommand(bufnr(''))
-Execute(The language string should be correct):
- AssertEqual 'php', ale_linters#php#langserver#GetLanguage(bufnr(''))
-
Execute(The project path should be correct for .git directories):
call ale#test#SetFilename('php-langserver-project/test.php')
call mkdir(g:dir . '/.git')
diff --git a/test/command_callback/test_rust_rls_callbacks.vader b/test/command_callback/test_rust_rls_callbacks.vader
index d537bccb..16bde98a 100644
--- a/test/command_callback/test_rust_rls_callbacks.vader
+++ b/test/command_callback/test_rust_rls_callbacks.vader
@@ -35,9 +35,6 @@ Execute(The toolchain should be ommitted if not given):
\ ale#Escape('rls'),
\ ale_linters#rust#rls#GetCommand(bufnr(''))
-Execute(The language string should be correct):
- AssertEqual 'rust', ale_linters#rust#rls#GetLanguage(bufnr(''))
-
Execute(The project root should be detected correctly):
AssertEqual '', ale_linters#rust#rls#GetProjectRoot(bufnr(''))
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'})
diff --git a/test/test_linter_defintion_processing.vader b/test/test_linter_defintion_processing.vader
index d946a600..653587b6 100644
--- a/test/test_linter_defintion_processing.vader
+++ b/test/test_linter_defintion_processing.vader
@@ -421,6 +421,30 @@ Execute(PreProcess should accept LSP server configurations):
AssertEqual 'socket', ale#linter#PreProcess(g:linter).lsp
+Execute(PreProcess should accept let you specify the language as just a string):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'lsp': 'socket',
+ \ 'address_callback': 'X',
+ \ 'language': 'foobar',
+ \ 'project_root_callback': 'x',
+ \}
+
+ AssertEqual 'foobar', ale#linter#PreProcess(g:linter).language_callback(0)
+
+Execute(PreProcess should complain about using language and language_callback together):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'lsp': 'socket',
+ \ 'address_callback': 'X',
+ \ 'language': 'x',
+ \ 'language_callback': 'x',
+ \ 'project_root_callback': 'x',
+ \}
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual 'Only one of `language` or `language_callback` should be set', g:vader_exception
+
Execute(PreProcess should require an address_callback for LSP socket configurations):
let g:linter = {
\ 'name': 'x',