summaryrefslogtreecommitdiff
path: root/test/test_linter_defintion_processing.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-08 13:52:29 +0100
committerw0rp <devw0rp@gmail.com>2017-06-08 13:52:29 +0100
commit04190cbcfe1b1b0681e3c9098b27633c2fc7c870 (patch)
tree5035a6430c2dfd6e04096b59b5142c016e51eff7 /test/test_linter_defintion_processing.vader
parentd8d96fb0eb193c504680d3e21489c761fce46172 (diff)
downloadale-04190cbcfe1b1b0681e3c9098b27633c2fc7c870.zip
#517 Support linter settings needed for LSP, undocumented for now
Diffstat (limited to 'test/test_linter_defintion_processing.vader')
-rw-r--r--test/test_linter_defintion_processing.vader71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/test_linter_defintion_processing.vader b/test/test_linter_defintion_processing.vader
index 09566557..9c880c20 100644
--- a/test/test_linter_defintion_processing.vader
+++ b/test/test_linter_defintion_processing.vader
@@ -365,3 +365,74 @@ Execute(PreProcess should accept `aliases` lists):
let g:linter.aliases = ['foo', 'bar']
AssertEqual ['foo', 'bar'], ale#linter#PreProcess(g:linter).aliases
+
+Execute(PreProcess should accept tsserver LSP configuration):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'executable': 'x',
+ \ 'lsp': 'tsserver',
+ \ 'callback': 'x',
+ \}
+
+ AssertEqual 'tsserver', ale#linter#PreProcess(g:linter).lsp
+
+ call remove(g:linter, 'executable')
+ let g:linter.executable_callback = 'X'
+
+ call ale#linter#PreProcess(g:linter).lsp
+
+Execute(PreProcess should complain about commands being set for LSP configurations):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'executable': 'x',
+ \ 'lsp': 'tsserver',
+ \ 'command': 'x',
+ \ 'callback': 'x',
+ \}
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual '`command` and `command_callback` and `command_chain` cannot be used when `lsp` is set', g:vader_exception
+
+ call remove(g:linter, 'command')
+ let g:linter.command_callback = 'X'
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual '`command` and `command_callback` and `command_chain` cannot be used when `lsp` is set', g:vader_exception
+
+ call remove(g:linter, 'command_callback')
+ let g:linter.command_chain = []
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual '`command` and `command_callback` and `command_chain` cannot be used when `lsp` is set', g:vader_exception
+
+Execute(PreProcess should accept LSP server configurations):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'lsp': 'lsp',
+ \ 'callback': 'x',
+ \ 'address_callback': 'X',
+ \}
+
+ AssertEqual 'lsp', ale#linter#PreProcess(g:linter).lsp
+
+Execute(PreProcess should require an address_callback for LSP server configurations):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'lsp': 'lsp',
+ \ 'callback': 'x',
+ \}
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual '`address_callback` must be defined for getting the LSP address', g:vader_exception
+
+Execute(PreProcess should complain about address_callback for non-LSP linters):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'callback': 'SomeFunction',
+ \ 'executable': 'echo',
+ \ 'command': 'echo',
+ \ 'address_callback': 'X',
+ \}
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual '`address_callback` cannot be used when lsp != ''lsp''', g:vader_exception