diff options
author | w0rp <devw0rp@gmail.com> | 2018-04-10 21:05:22 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-04-10 21:05:22 +0100 |
commit | f064ba48f5893f25c1af9459b309a919a392db7c (patch) | |
tree | 00b33c7c7f86ae201ca5908b2a7e9f71c3588ac2 /test/test_loclist_binary_search.vader | |
parent | 3f0e1cd05dc526b073946ad96c64f6a5e2f9e4e6 (diff) | |
download | ale-f064ba48f5893f25c1af9459b309a919a392db7c.zip |
Close #1494 - Prefer displaying higher severity problems for cursor messages, balloons, and highlights
Diffstat (limited to 'test/test_loclist_binary_search.vader')
-rw-r--r-- | test/test_loclist_binary_search.vader | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_loclist_binary_search.vader b/test/test_loclist_binary_search.vader index 5558191c..219fb314 100644 --- a/test/test_loclist_binary_search.vader +++ b/test/test_loclist_binary_search.vader @@ -47,3 +47,20 @@ Execute(Searches should work with just one item): let g:loclist = [{'bufnr': 1, 'lnum': 3, 'col': 10}] AssertEqual 0, ale#util#BinarySearch(g:loclist, 1, 3, 2) + +Execute(Searches should return the last item on a single column): + let g:loclist = [ + \ {'bufnr': 1, 'lnum': 1, 'col': 10, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 10, 'type': 'E'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 11, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 11, 'type': 'E'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 20, 'type': 'W'}, + \ {'bufnr': 1, 'lnum': 1, 'col': 20, 'type': 'E'}, + \] + + " We should return the index for the last item at some column to the right. + AssertEqual 1, ale#util#BinarySearch(g:loclist, 1, 1, 1) + " We should return the index for the last item at the column we are on. + AssertEqual 3, ale#util#BinarySearch(g:loclist, 1, 1, 11) + " We should prefer items to the left of the cursor, over the right. + AssertEqual 3, ale#util#BinarySearch(g:loclist, 1, 1, 19) |