diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-08 00:46:42 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-08 00:46:42 +0100 |
commit | 16cfedf04a46a3d498dfd4f7293c555562d0776e (patch) | |
tree | 80440fdc42c41f855a3936e2128ad7d68296d94a /test | |
parent | 2edea153585560e5788d1761595eb0141ad6e3bd (diff) | |
download | ale-16cfedf04a46a3d498dfd4f7293c555562d0776e.zip |
Fix #271 - Add the ability to open the quickfix or loclist windows only after saving a file
Diffstat (limited to 'test')
-rw-r--r-- | test/test_lint_file_linters.vader | 16 | ||||
-rw-r--r-- | test/test_list_opening.vader | 34 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/test_lint_file_linters.vader b/test/test_lint_file_linters.vader index 4110c059..2eb9b2e6 100644 --- a/test/test_lint_file_linters.vader +++ b/test/test_lint_file_linters.vader @@ -81,6 +81,8 @@ Before: After: Restore + unlet! b:ale_save_event_fired + unlet! b:ale_enabled unlet g:buffer_result let g:ale_buffer_info = {} call ale#linter#Reset() @@ -251,3 +253,17 @@ Execute(The Save event should respect the buffer number): \ 'type': 'E', \ }, \], GetSimplerLoclist() + +Execute(The Save event should set b:ale_save_event_fired to 1): + let b:ale_enabled = 0 + call ale#events#SaveEvent(bufnr('')) + + " This flag needs to be set so windows can be opened, etc. + AssertEqual 1, b:ale_save_event_fired + +Execute(b:ale_save_event_fired should be set to 0 when results are set): + let b:ale_save_event_fired = 1 + + call ale#engine#SetResults(bufnr(''), []) + + AssertEqual 0, b:ale_save_event_fired diff --git a/test/test_list_opening.vader b/test/test_list_opening.vader index a46f28e5..253efa46 100644 --- a/test/test_list_opening.vader +++ b/test/test_list_opening.vader @@ -34,6 +34,10 @@ After: unlet! g:loclist unlet! b:ale_list_window_size + unlet! b:ale_open_list + unlet! b:ale_keep_list_window_open + unlet! b:ale_save_event_fired + delfunction GetQuickfixHeight " Close quickfix window after every execute block @@ -163,3 +167,33 @@ Execute(The quickfix window height should be correct for the quickfix list with call ale#list#CloseWindowIfNeeded(bufnr('')) AssertEqual 8, GetQuickfixHeight() + +Execute(The buffer ale_open_list option should be respected): + let b:ale_open_list = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + Assert ale#list#IsQuickfixOpen() + +Execute(The buffer ale_keep_list_window_open option should be respected): + let b:ale_open_list = 1 + let b:ale_keep_list_window_open = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + call ale#list#CloseWindowIfNeeded(bufnr('')) + call ale#list#SetLists(bufnr('%'), []) + call ale#list#CloseWindowIfNeeded(bufnr('')) + + Assert ale#list#IsQuickfixOpen() + +Execute(The ale_open_list='on_save' option should work): + let b:ale_open_list = 'on_save' + + call ale#list#SetLists(bufnr('%'), g:loclist) + " The list shouldn't open yet, the event wasn't fired. + Assert !ale#list#IsQuickfixOpen() + + let b:ale_save_event_fired = 1 + + call ale#list#SetLists(bufnr('%'), g:loclist) + " Now the list should have opened. + Assert ale#list#IsQuickfixOpen() |