diff options
author | w0rp <devw0rp@gmail.com> | 2017-03-09 00:43:53 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-03-09 00:43:53 +0000 |
commit | ad49846a48beab2ed7fe58a799e6a53e99086bb2 (patch) | |
tree | 44b1aae0a55fee6a60ba7c28d69e12df3df7f66a /test | |
parent | 1c3f0b1e197a08e02a2cddfe1c3e0a0e9c62eb44 (diff) | |
download | ale-ad49846a48beab2ed7fe58a799e6a53e99086bb2.zip |
#376 Use the window ID for a given buffer for setting the loclist
Diffstat (limited to 'test')
-rw-r--r-- | test/test_list_opening.vader | 20 | ||||
-rw-r--r-- | test/test_setting_loclist_from_another_buffer.vader | 13 |
2 files changed, 23 insertions, 10 deletions
diff --git a/test/test_list_opening.vader b/test/test_list_opening.vader index e3517bf3..942f592f 100644 --- a/test/test_list_opening.vader +++ b/test/test_list_opening.vader @@ -35,18 +35,18 @@ Execute(IsQuickfixOpen should return the right output): AssertEqual 0, ale#list#IsQuickfixOpen() Execute(The quickfix window should not open by default for the loclist): - call ale#list#SetLists(g:loclist) + call ale#list#SetLists(bufnr('%'), g:loclist) Assert !ale#list#IsQuickfixOpen() Execute(The quickfix window should open for just the loclist): let g:ale_open_list = 1 " It should not open for an empty list. - call ale#list#SetLists([]) + call ale#list#SetLists(bufnr('%'), []) Assert !ale#list#IsQuickfixOpen() " With a non-empty loclist, the window must open. - call ale#list#SetLists(g:loclist) + call ale#list#SetLists(bufnr('%'), g:loclist) Assert ale#list#IsQuickfixOpen() Execute(The quickfix window should stay open for just the loclist): @@ -54,14 +54,14 @@ Execute(The quickfix window should stay open for just the loclist): let g:ale_keep_list_window_open = 1 " The window should stay open after even after it is made blank again. - call ale#list#SetLists(g:loclist) - call ale#list#SetLists([]) + call ale#list#SetLists(bufnr('%'), g:loclist) + call ale#list#SetLists(bufnr('%'), []) Assert ale#list#IsQuickfixOpen() Execute(The quickfix window should not open by default when quickfix is on): let g:ale_set_quickfix = 1 - call ale#list#SetLists(g:loclist) + call ale#list#SetLists(bufnr('%'), g:loclist) Assert !ale#list#IsQuickfixOpen() Execute(The quickfix window should open for the quickfix list): @@ -69,11 +69,11 @@ Execute(The quickfix window should open for the quickfix list): let g:ale_open_list = 1 " It should not open for an empty list. - call ale#list#SetLists([]) + call ale#list#SetLists(bufnr('%'), []) Assert !ale#list#IsQuickfixOpen() " With a non-empty quickfix list, the window must open. - call ale#list#SetLists(g:loclist) + call ale#list#SetLists(bufnr('%'), g:loclist) Assert ale#list#IsQuickfixOpen() Execute(The quickfix window should stay open for the quickfix list): @@ -82,6 +82,6 @@ Execute(The quickfix window should stay open for the quickfix list): let g:ale_keep_list_window_open = 1 " The window should stay open after even after it is made blank again. - call ale#list#SetLists(g:loclist) - call ale#list#SetLists([]) + call ale#list#SetLists(bufnr('%'), g:loclist) + call ale#list#SetLists(bufnr('%'), []) Assert ale#list#IsQuickfixOpen() diff --git a/test/test_setting_loclist_from_another_buffer.vader b/test/test_setting_loclist_from_another_buffer.vader new file mode 100644 index 00000000..4b757c61 --- /dev/null +++ b/test/test_setting_loclist_from_another_buffer.vader @@ -0,0 +1,13 @@ +Before: + let g:original_buffer = bufnr('%') + new + +After: + unlet! g:original_buffer + +Execute(Errors should be set in the loclist for the original buffer, not the new one): + call ale#list#SetLists(g:original_buffer, [{'lnum': 4, 'text': 'foo'}]) + + AssertEqual [], getloclist(0) + AssertEqual 1, len(getloclist(bufwinid(g:original_buffer))) + AssertEqual 'foo', getloclist(bufwinid(g:original_buffer))[0].text |