diff options
Diffstat (limited to 'test/test_highlight_placement.vader')
-rw-r--r-- | test/test_highlight_placement.vader | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader index 2d87b771..6a84e571 100644 --- a/test/test_highlight_placement.vader +++ b/test/test_highlight_placement.vader @@ -1,4 +1,6 @@ Before: + Save g:ale_enabled + function! GenerateResults(buffer, output) return [ \ { @@ -43,7 +45,10 @@ Before: highlight link SomeOtherGroup SpellBad After: + Restore + unlet! g:items + unlet! b:ale_enabled delfunction GenerateResults call ale#linter#Reset() @@ -206,7 +211,7 @@ Execute(Highlighting should support errors spanning many lines): \ }, \ ], \ GetMatchesWithoutIDs() - \ + Execute(Highlights should always be cleared when the buffer highlight list is empty): " Add our highlights and something else. call matchaddpos('ALEError', [[1, 1, 1]]) @@ -232,3 +237,24 @@ Execute(Highlights should always be cleared when the buffer highlight list is em \ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]}, \ ], \ GetMatchesWithoutIDs() + +Execute(Highlights should be cleared when ALE is disabled): + let g:ale_enabled = 1 + call ale#highlight#SetHighlights(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3}, + \]) + + let g:ale_enabled = 0 + call ale#highlight#UpdateHighlights() + + AssertEqual [], GetMatchesWithoutIDs() + + let g:ale_enabled = 1 + call ale#highlight#SetHighlights(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3}, + \]) + + let b:ale_enabled = 0 + call ale#highlight#UpdateHighlights() + + AssertEqual [], GetMatchesWithoutIDs() |