From f064ba48f5893f25c1af9459b309a919a392db7c Mon Sep 17 00:00:00 2001 From: w0rp Date: Tue, 10 Apr 2018 21:05:22 +0100 Subject: Close #1494 - Prefer displaying higher severity problems for cursor messages, balloons, and highlights --- test/test_loclist_binary_search.vader | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/test_loclist_binary_search.vader') 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) -- cgit v1.2.3