summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-20 13:27:18 +0100
committerw0rp <devw0rp@gmail.com>2017-08-20 13:27:18 +0100
commit753cf5da95fa4c64e31c7e3fbfcd0227c89791c1 (patch)
tree604ec1f6c0fb27e81a9757cb7f2bd9403273e315 /test
parente5d0a17694897dc8e234f534cfa33fc3483d8e12 (diff)
downloadale-753cf5da95fa4c64e31c7e3fbfcd0227c89791c1.zip
#653 - Automatically accept annoying loclist and quickfix errors from Vim
Diffstat (limited to 'test')
-rw-r--r--test/test_ale_init_au_groups.vader1
-rw-r--r--test/test_completion.vader4
-rw-r--r--test/test_list_modification_error_cancelling.vader54
3 files changed, 56 insertions, 3 deletions
diff --git a/test/test_ale_init_au_groups.vader b/test/test_ale_init_au_groups.vader
index 216e7cfb..109f84ae 100644
--- a/test/test_ale_init_au_groups.vader
+++ b/test/test_ale_init_au_groups.vader
@@ -128,6 +128,7 @@ Execute (g:ale_lint_on_enter = 1 should bind the required events):
\ 'BufEnter * call ale#events#EnterEvent(str2nr(expand(''<abuf>'')))',
\ 'BufReadPost * call ale#Queue(0, ''lint_file'', str2nr(expand(''<abuf>'')))',
\ 'BufWinEnter * call ale#Queue(0, ''lint_file'', str2nr(expand(''<abuf>'')))',
+ \ 'BufWinLeave * call ale#events#BufWinLeave()',
\ 'FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand(''<abuf>'')))',
\], CheckAutocmd('ALERunOnEnterGroup')
diff --git a/test/test_completion.vader b/test/test_completion.vader
index f3f552b7..811a2645 100644
--- a/test/test_completion.vader
+++ b/test/test_completion.vader
@@ -9,9 +9,7 @@ Before:
\ 'feedkeys_calls': [],
\}
- call ale#completion#Nop()
-
- function! ale#completion#FeedKeys(string, mode) abort
+ function! ale#util#FeedKeys(string, mode) abort
call add(g:test_vars.feedkeys_calls, [a:string, a:mode])
endfunction
diff --git a/test/test_list_modification_error_cancelling.vader b/test/test_list_modification_error_cancelling.vader
new file mode 100644
index 00000000..06449621
--- /dev/null
+++ b/test/test_list_modification_error_cancelling.vader
@@ -0,0 +1,54 @@
+Before:
+ let b:fake_mode = 'r'
+ let b:feedkeys_calls = []
+
+ " Mock mode() and feedkeys() for the check
+ function! ale#util#Mode(...) abort
+ return b:fake_mode
+ endfunction
+
+ function! ale#util#FeedKeys(...) abort
+ call add(b:feedkeys_calls, a:000)
+ endfunction
+
+ function! CheckError(mode, message, expected_list) abort
+ let b:fake_mode = a:mode
+
+ echom a:message
+
+ call ale#events#BufWinLeave()
+ AssertEqual [], b:feedkeys_calls
+
+ sleep 1ms
+ AssertEqual a:expected_list, b:feedkeys_calls
+ endfunction
+
+After:
+ unlet! b:fake_mode
+ unlet! b:feedkeys_calls
+
+ delfunction CheckError
+
+ runtime autoload/ale/util.vim
+
+Execute(The BufWinLeave event function should hide E924 errors):
+ " For some reason, this test fails the first time when running in NeoVim
+ " in Docker, so just execute this twice.
+ echom 'E924'
+ call ale#events#BufWinLeave()
+ sleep 1ms
+ let b:feedkeys_calls = []
+
+ call CheckError('r', 'E924', [["\<CR>", 'n']])
+
+Execute(The BufWinLeave event function should hide E925 errors):
+ call CheckError('r', 'E925', [["\<CR>", 'n']])
+
+Execute(The BufWinLeave event function should hide E926 errors):
+ call CheckError('r', 'E926', [["\<CR>", 'n']])
+
+Execute(The BufWinLeave event function should ignore other errors):
+ call CheckError('r', 'E999', [])
+
+Execute(The BufWinLeave event function not send keys for other modes):
+ call CheckError('n', 'E924', [])