diff options
author | cs86661 <cs86661@msn.com> | 2017-06-01 05:55:23 +0800 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-05-31 22:55:23 +0100 |
commit | 81f27a99c882fde3dfa004e6494efcd27b5d5e96 (patch) | |
tree | 228fc7470c7dbb1ce2ed831f2dd9545680385c15 /test/test_list_titles.vader | |
parent | 735a6a2a885d8c5581a19f16998b4b6209742bd5 (diff) | |
download | ale-81f27a99c882fde3dfa004e6494efcd27b5d5e96.zip |
Set qflist/loclist window title properly ... (#588)
* Update list.vim
Set qflist/loclist window title properly ...
* Update list.vim
1. Remove redundant code.
2. Get absolute path from 'a:buffer'.
* Set the list window titles appropriately for each version of Vim, and add tests
Diffstat (limited to 'test/test_list_titles.vader')
-rw-r--r-- | test/test_list_titles.vader | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/test_list_titles.vader b/test/test_list_titles.vader new file mode 100644 index 00000000..fe28629d --- /dev/null +++ b/test/test_list_titles.vader @@ -0,0 +1,63 @@ +Before: + Save g:ale_set_loclist + Save g:ale_set_quickfix + + let g:ale_set_loclist = 0 + let g:ale_set_quickfix = 0 + + silent! cd /testplugin/test + +After: + Restore + + call setloclist(0, []) + call setqflist([]) + +Execute(The loclist titles should be set appropriately): + silent noautocmd file foo + + let g:ale_set_loclist = 1 + + call ale#list#SetLists(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}, + \]) + + AssertEqual [{ + \ 'lnum': 5, + \ 'bufnr': bufnr(''), + \ 'col': 5, + \ 'text': 'x', + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \}], getloclist(0) + + if !has('nvim') + AssertEqual {'title': getcwd() . '/foo'}, getloclist(0, {'title': ''}) + endif + +Execute(The quickfix titles should be set appropriately): + silent noautocmd file foo + + let g:ale_set_quickfix = 1 + + call ale#list#SetLists(bufnr(''), [ + \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}, + \]) + AssertEqual [{ + \ 'lnum': 5, + \ 'bufnr': bufnr(''), + \ 'col': 5, + \ 'text': 'x', + \ 'valid': 1, + \ 'vcol': 0, + \ 'nr': 0, + \ 'type': 'E', + \ 'pattern': '', + \}], getqflist() + + if !has('nvim') + AssertEqual {'title': getcwd() . '/foo'}, getqflist({'title': ''}) + endif |