summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-01-22 13:33:16 +0000
committerw0rp <devw0rp@gmail.com>2017-01-22 13:33:16 +0000
commita37970facd747bb1e5be3e90b608f8e2ae0dd871 (patch)
tree28f5e22c6caf57f88d868611d15aed179f7b25aa
parenta23173eeb29d538fa323b1abfef91797c878ebe2 (diff)
downloadale-a37970facd747bb1e5be3e90b608f8e2ae0dd871.zip
Clean up the list opening tests
-rw-r--r--test/test_list_opening.vader87
-rw-r--r--test/test_loclist_quicklist.vader96
2 files changed, 87 insertions, 96 deletions
diff --git a/test/test_list_opening.vader b/test/test_list_opening.vader
new file mode 100644
index 00000000..e3517bf3
--- /dev/null
+++ b/test/test_list_opening.vader
@@ -0,0 +1,87 @@
+" Author: Yann Fery <yann@fery.me>
+
+Before:
+ let g:loclist = [
+ \ {'lnum': 5, 'col': 5},
+ \ {'lnum': 5, 'col': 4},
+ \ {'lnum': 2, 'col': 10},
+ \ {'lnum': 3, 'col': 2},
+ \]
+
+After:
+ " Close quickfix window after every execute block
+ lcl
+ ccl
+ unlet g:loclist
+ call setloclist(0, [])
+ call setqflist([])
+ " Reset options to their default values.
+ let g:ale_set_loclist = 1
+ let g:ale_set_quickfix = 0
+ let g:ale_open_list = 0
+ let g:ale_keep_list_window_open = 0
+
+Execute(IsQuickfixOpen should return the right output):
+ AssertEqual 0, ale#list#IsQuickfixOpen()
+ call setloclist(0, g:loclist)
+ lopen
+ AssertEqual 1, ale#list#IsQuickfixOpen()
+ lcl
+ AssertEqual 0, ale#list#IsQuickfixOpen()
+ call setqflist(g:loclist)
+ copen
+ AssertEqual 1, ale#list#IsQuickfixOpen()
+ ccl
+ AssertEqual 0, ale#list#IsQuickfixOpen()
+
+Execute(The quickfix window should not open by default for the loclist):
+ call ale#list#SetLists(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([])
+ Assert !ale#list#IsQuickfixOpen()
+
+ " With a non-empty loclist, the window must open.
+ call ale#list#SetLists(g:loclist)
+ Assert ale#list#IsQuickfixOpen()
+
+Execute(The quickfix window should stay open for just the loclist):
+ let g:ale_open_list = 1
+ 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([])
+ 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)
+ Assert !ale#list#IsQuickfixOpen()
+
+Execute(The quickfix window should open for the quickfix list):
+ let g:ale_set_quickfix = 1
+ let g:ale_open_list = 1
+
+ " It should not open for an empty list.
+ call ale#list#SetLists([])
+ Assert !ale#list#IsQuickfixOpen()
+
+ " With a non-empty quickfix list, the window must open.
+ call ale#list#SetLists(g:loclist)
+ Assert ale#list#IsQuickfixOpen()
+
+Execute(The quickfix window should stay open for the quickfix list):
+ let g:ale_set_quickfix = 1
+ let g:ale_open_list = 1
+ 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([])
+ Assert ale#list#IsQuickfixOpen()
diff --git a/test/test_loclist_quicklist.vader b/test/test_loclist_quicklist.vader
deleted file mode 100644
index e3a47a4e..00000000
--- a/test/test_loclist_quicklist.vader
+++ /dev/null
@@ -1,96 +0,0 @@
-" Author: Yann Fery <yann@fery.me>
-
-Before:
- let g:loclist = [
- \ {'lnum': 5, 'col': 5},
- \ {'lnum': 5, 'col': 4},
- \ {'lnum': 2, 'col': 10},
- \ {'lnum': 3, 'col': 2},
- \]
- let g:empty_loclist = []
-
-After:
- " Close quickfix window after every execute block
- lcl
- ccl
- unlet g:loclist
- unlet g:empty_loclist
-
-Execute (IsQuickfixOpen):
- AssertEqual 0, ale#list#IsQuickfixOpen()
- call setloclist(0, g:loclist)
- lopen
- AssertEqual 1, ale#list#IsQuickfixOpen()
- lcl
- AssertEqual 0, ale#list#IsQuickfixOpen()
- call setqflist(g:loclist)
- copen
- AssertEqual 1, ale#list#IsQuickfixOpen()
- ccl
- AssertEqual 0, ale#list#IsQuickfixOpen()
-
-Execute (loclist and openlist):
- let g:ale_set_loclist = 1
- let g:ale_set_quickfix = 0
- let g:ale_open_list = 1
- let g:ale_keep_list_window_open = 0
- " With empty loclist, window must stay close
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 0, ale#list#IsQuickfixOpen()
- " With a loclist it must open
- call ale#list#SetLists(g:loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
- " And with keep open option, must stay open even with empty loclist
- let g:ale_keep_list_window_open = 1
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
-
-Execute (loclist without openlist):
- let g:ale_set_loclist = 1
- let g:ale_set_quickfix = 0
- let g:ale_open_list = 0
- " Must stay close without loclist
- let g:ale_keep_list_window_open = 0
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 0, ale#list#IsQuickfixOpen()
- call ale#list#SetLists(g:loclist)
- AssertEqual 0, ale#list#IsQuickfixOpen()
- " Must stay open event without loclist
- let g:ale_keep_list_window_open = 1
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
- call ale#list#SetLists(g:loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
-
-Execute (quickfix and openlist):
- let g:ale_set_loclist = 0
- let g:ale_set_quickfix = 1
- let g:ale_open_list = 1
- let g:ale_keep_list_window_open = 0
- " With empty loclist, window must stay close
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 0, ale#list#IsQuickfixOpen()
- " With a loclist it must open
- call ale#list#SetLists(g:loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
- " And with keep open option, must stay open even with empty loclist
- let g:ale_keep_list_window_open = 1
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
-
-Execute (quickfix without openlist):
- let g:ale_set_loclist = 0
- let g:ale_set_quickfix = 1
- let g:ale_open_list = 0
- " Must stay close without loclist
- let g:ale_keep_list_window_open = 0
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 0, ale#list#IsQuickfixOpen()
- call ale#list#SetLists(g:loclist)
- AssertEqual 0, ale#list#IsQuickfixOpen()
- " Must stay open event without loclist
- let g:ale_keep_list_window_open = 1
- call ale#list#SetLists(g:empty_loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()
- call ale#list#SetLists(g:loclist)
- AssertEqual 1, ale#list#IsQuickfixOpen()