From 2d02de33d4ac8b90437b13467956530b8df32bf1 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 13 Aug 2017 16:30:46 +0100 Subject: #653 - Filter items based on the buffer number for signs --- test/sign/test_sign_placement.vader | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/sign/test_sign_placement.vader b/test/sign/test_sign_placement.vader index c5059a1d..f5b55baf 100644 --- a/test/sign/test_sign_placement.vader +++ b/test/sign/test_sign_placement.vader @@ -124,7 +124,6 @@ Execute(The current signs should be set for running a job): \ ], \ ParseSigns() - Execute(Loclist items with sign_id values should be kept): exec 'sign place 1000347 line=3 name=ALEErrorSign buffer=' . bufnr('%') exec 'sign place 1000348 line=15 name=ALEErrorSign buffer=' . bufnr('%') @@ -169,5 +168,32 @@ Execute(Loclist items with sign_id values should be kept): \ ], \ sort(ParseSigns()) +Execute(Items for other buffers should be ignored): + let g:loclist = [ + \ {'bufnr': bufnr('') - 1, 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'}, + \ {'bufnr': bufnr('') - 1, 'lnum': 2, 'col': 1, 'type': 'E', 'text': 'a', 'sign_id': 1000347}, + \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'}, + \ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'W', 'text': 'b'}, + \ {'bufnr': bufnr(''), 'lnum': 3, 'col': 1, 'type': 'E', 'text': 'c'}, + \ {'bufnr': bufnr(''), 'lnum': 4, 'col': 1, 'type': 'W', 'text': 'd'}, + \ {'bufnr': bufnr(''), 'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}, + \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'}, + \ {'bufnr': bufnr('') + 1, 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'}, + \] + + call ale#sign#SetSigns(bufnr(''), g:loclist) + call ale#sign#RemoveDummySignIfNeeded(bufnr('')) + + AssertEqual + \ [ + \ ['1', '1000001', 'ALEErrorSign'], + \ ['15', '1000005', 'ALEWarningSign'], + \ ['16', '1000006', 'ALEErrorSign'], + \ ['2', '1000002', 'ALEWarningSign'], + \ ['3', '1000003', 'ALEErrorSign'], + \ ['4', '1000004', 'ALEWarningSign'], + \ ], + \ sort(ParseSigns()) + Execute(No excpetions should be thrown when setting signs for invalid buffers): call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}]) -- cgit v1.2.3