summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-05-24 01:13:52 +0100
committerw0rp <devw0rp@gmail.com>2019-05-24 01:13:52 +0100
commit36c35d840ba90c5069eb514d54a1281d42c3fb26 (patch)
tree591191b48198e3a3dd80c57d8c8f82dc0affb088
parent33b4a905079c0d8ecafc265c0a31b3141b034b87 (diff)
downloadale-36c35d840ba90c5069eb514d54a1281d42c3fb26.zip
Fix LSP tests
-rw-r--r--test/lsp/test_did_save_event.vader1
-rw-r--r--test/lsp/test_engine_lsp_response_handling.vader (renamed from test/test_engine_lsp_response_handling.vader)27
-rw-r--r--test/test_history_saving.vader3
-rw-r--r--test/test_ignoring_linters.vader12
4 files changed, 36 insertions, 7 deletions
diff --git a/test/lsp/test_did_save_event.vader b/test/lsp/test_did_save_event.vader
index 1a60bc9f..bdea6d98 100644
--- a/test/lsp/test_did_save_event.vader
+++ b/test/lsp/test_did_save_event.vader
@@ -9,6 +9,7 @@ Before:
call ale#test#SetFilename('dummy.txt')
runtime autoload/ale/lsp.vim
+ runtime autoload/ale/lsp_linter.vim
let g:ale_disable_lsp = 0
unlet! b:ale_disable_lsp
diff --git a/test/test_engine_lsp_response_handling.vader b/test/lsp/test_engine_lsp_response_handling.vader
index 34b0de3b..9abfa087 100644
--- a/test/test_engine_lsp_response_handling.vader
+++ b/test/lsp/test_engine_lsp_response_handling.vader
@@ -1,19 +1,42 @@
Before:
+ Save g:ale_set_lists_synchronously
Save g:ale_buffer_info
Save g:ale_lsp_error_messages
-
+ Save g:ale_set_loclist
+ Save g:ale_set_signs
+ Save g:ale_set_quickfix
+ Save g:ale_set_highlights
+ Save g:ale_echo_cursor
+ Save g:ale_disable_lsp
+ Save g:ale_history_enabled
+ Save g:ale_history_log_output
+
+ let g:ale_disable_lsp = 0
+ let g:ale_set_lists_synchronously = 1
let g:ale_buffer_info = {}
+ let g:ale_set_loclist = 1
+ " Disable features we don't need for these tests.
+ let g:ale_set_signs = 0
+ let g:ale_set_quickfix = 0
+ let g:ale_set_highlights = 0
+ let g:ale_echo_cursor = 0
+ let g:ale_history_enabled = 1
+ let g:ale_history_log_output = 1
unlet! g:ale_lsp_error_messages
unlet! b:ale_linters
+ unlet! b:ale_disable_lsp
+ call ale#linter#Reset()
call ale#test#SetDirectory('/testplugin/test')
+ call setloclist(0, [])
After:
Restore
unlet! b:ale_linters
+ call setloclist(0, [])
call ale#test#RestoreDirectory()
call ale#linter#Reset()
call ale#lsp_linter#ClearLSPData()
@@ -281,7 +304,7 @@ Execute(LSP diagnostics responses should be handled correctly):
\ [
\ {
\ 'lnum': 1,
- \ 'bufnr': 3,
+ \ 'bufnr': bufnr(''),
\ 'col': 1,
\ 'pattern': '',
\ 'valid': 1,
diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader
index 18b64db5..5d81c2a3 100644
--- a/test/test_history_saving.vader
+++ b/test/test_history_saving.vader
@@ -1,5 +1,6 @@
Before:
Save g:ale_max_buffer_history_size
+ Save g:ale_history_enabled
Save g:ale_history_log_output
Save g:ale_run_synchronously
Save g:ale_enabled
@@ -54,8 +55,6 @@ After:
" Reset the shell back to what it was before.
let &shell = g:current_shell
unlet g:current_shell
- let g:ale_history_enabled = 1
- let g:ale_history_log_output = 0
unlet g:history
call ale#engine#Cleanup(bufnr(''))
diff --git a/test/test_ignoring_linters.vader b/test/test_ignoring_linters.vader
index f2e9e5c9..d758af5c 100644
--- a/test/test_ignoring_linters.vader
+++ b/test/test_ignoring_linters.vader
@@ -1,3 +1,11 @@
+Before:
+ Save g:ale_disable_lsp
+
+After:
+ Restore
+
+ unlet! b:ale_disable_lsp
+
Execute(GetList should ignore some invalid values):
AssertEqual [], ale#engine#ignore#GetList('', 'foo')
AssertEqual [], ale#engine#ignore#GetList('', 0)
@@ -98,7 +106,6 @@ Execute(Exclude should handle Dictionaries):
\ )
Execute(Exclude should filter LSP linters when g:ale_disable_lsp is set to 1):
- let g:ale_disable_lsp = 1
AssertEqual
\ [
\ {'name': 'linter1', 'aliases': [], 'lsp': ''},
@@ -116,7 +123,6 @@ Execute(Exclude should filter LSP linters when g:ale_disable_lsp is set to 1):
\ )
Execute(Exclude should filter LSP linters when b:ale_disable_lsp is set to 1):
- let b:ale_disable_lsp = 1
AssertEqual
\ [
\ {'name': 'linter1', 'aliases': [], 'lsp': ''},
@@ -351,7 +357,7 @@ Execute(ale_disable_lsp should be applied for tsserver):
AssertEqual [], g:loclist
-Execute(ale_disable_lsp should be applied for LSP linters):
+Execute(ale_disable_lsp should be applied for LSP linters):
call ale#test#SetFilename('filename.py')
call ale#engine#InitBufferInfo(bufnr(''))
call ale#lsp_linter#SetLSPLinterMap({'347': 'lsplinter'})