diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-21 18:58:26 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-21 18:58:26 +0100 |
commit | 57ad32f98656eebdc8c903d670c92cf458b31dce (patch) | |
tree | cf281d548f0ff358b144d74280fa0722757d79cc | |
parent | d511b02ebe23de8356233b1eccf36da3795350a7 (diff) | |
download | ale-57ad32f98656eebdc8c903d670c92cf458b31dce.zip |
Fix counting of warnings and style warnings
-rw-r--r-- | autoload/ale/statusline.vim | 4 | ||||
-rw-r--r-- | test/test_statusline.vader | 36 |
2 files changed, 27 insertions, 13 deletions
diff --git a/autoload/ale/statusline.vim b/autoload/ale/statusline.vim index 337db22d..bec8a6e4 100644 --- a/autoload/ale/statusline.vim +++ b/autoload/ale/statusline.vim @@ -28,9 +28,9 @@ function! ale#statusline#Update(buffer, loclist) abort for l:entry in a:loclist if l:entry.type ==# 'W' if get(l:entry, 'sub_type', '') ==# 'style' - let l:count.warning += 1 - else let l:count.style_warning += 1 + else + let l:count.warning += 1 endif elseif l:entry.type ==# 'I' let l:count.info += 1 diff --git a/test/test_statusline.vader b/test/test_statusline.vader index d7c6b15e..bd0fd5dc 100644 --- a/test/test_statusline.vader +++ b/test/test_statusline.vader @@ -46,20 +46,34 @@ Execute (Count should be match the loclist): let g:ale_buffer_info = { \ bufnr('%'): { \ 'loclist': [ - \ { - \ 'lnum': 1, - \ 'bufnr': 1, - \ 'vcol': 0, - \ 'linter_name': 'testlinter', - \ 'nr': -1, - \ 'type': 'E', - \ 'col': 1, - \ 'text': 'Test Error', - \ }, + \ {'type': 'E'}, + \ {'type': 'E', 'sub_type': 'style'}, + \ {'type': 'E', 'sub_type': 'style'}, + \ {'type': 'W'}, + \ {'type': 'W'}, + \ {'type': 'W'}, + \ {'type': 'W', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \ {'type': 'W', 'sub_type': 'style'}, + \ {'type': 'I'}, + \ {'type': 'I'}, + \ {'type': 'I'}, + \ {'type': 'I'}, + \ {'type': 'I'}, \ ], \ }, \} - AssertEqual Counts({'error': 1}), ale#statusline#Count(bufnr('%')) + AssertEqual { + \ 'error': 1, + \ 'style_error': 2, + \ 'warning': 3, + \ 'style_warning': 4, + \ 'info': 5, + \ '0': 3, + \ '1': 12, + \ 'total': 15, + \}, ale#statusline#Count(bufnr('%')) Execute (Output should be empty for non-existant buffer): AssertEqual Counts({}), ale#statusline#Count(9001) |