diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_statusline.vader | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/test/test_statusline.vader b/test/test_statusline.vader index bd0fd5dc..c47df75a 100644 --- a/test/test_statusline.vader +++ b/test/test_statusline.vader @@ -31,7 +31,7 @@ After: delfunction Counts Execute (Count should be 0 when data is empty): - AssertEqual Counts({}), ale#statusline#Count(bufnr('%')) + AssertEqual Counts({}), ale#statusline#Count(bufnr('')) Execute (Count should read data from the cache): let g:ale_buffer_info = {'44': {'count': Counts({'error': 1, 'warning': 2})}} @@ -44,23 +44,33 @@ Execute (The count should be correct after an update): Execute (Count should be match the loclist): let g:ale_buffer_info = { - \ bufnr('%'): { + \ bufnr(''): { \ 'loclist': [ - \ {'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'}, + \ {'bufnr': bufnr('') - 1, 'type': 'E'}, + \ {'bufnr': bufnr('') - 1, 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') - 1, 'type': 'W'}, + \ {'bufnr': bufnr('') - 1, 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') - 1, 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'E'}, + \ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, + \ {'bufnr': bufnr('') + 1, 'type': 'E'}, + \ {'bufnr': bufnr('') + 1, 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') + 1, 'type': 'W'}, + \ {'bufnr': bufnr('') + 1, 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr('') + 1, 'type': 'I'}, \ ], \ }, \} @@ -73,46 +83,46 @@ Execute (Count should be match the loclist): \ '0': 3, \ '1': 12, \ 'total': 15, - \}, ale#statusline#Count(bufnr('%')) + \}, ale#statusline#Count(bufnr('')) Execute (Output should be empty for non-existant buffer): AssertEqual Counts({}), ale#statusline#Count(9001) Execute (Status() should return just errors for the old format): let g:ale_statusline_format = ['%sE', '%sW', 'OKIE'] - let g:ale_buffer_info = {bufnr('%'): {}} - call ale#statusline#Update(bufnr('%'), [ - \ {'type': 'E'}, - \ {'type': 'E', 'sub_type': 'style'}, + let g:ale_buffer_info = {bufnr(''): {}} + call ale#statusline#Update(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E'}, + \ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, \]) AssertEqual '2E', ale#statusline#Status() Execute (Status() should return just warnings for the old format): let g:ale_statusline_format = ['%sE', '%sW', 'OKIE'] - let g:ale_buffer_info = {bufnr('%'): {}} - call ale#statusline#Update(bufnr('%'), [ - \ {'type': 'W'}, - \ {'type': 'W', 'sub_type': 'style'}, - \ {'type': 'I'}, + let g:ale_buffer_info = {bufnr(''): {}} + call ale#statusline#Update(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, \]) AssertEqual '3W', ale#statusline#Status() Execute (Status() should return errors and warnings for the old format): let g:ale_statusline_format = ['%sE', '%sW', 'OKIE'] - let g:ale_buffer_info = {bufnr('%'): {}} - call ale#statusline#Update(bufnr('%'), [ - \ {'type': 'E'}, - \ {'type': 'E', 'sub_type': 'style'}, - \ {'type': 'W'}, - \ {'type': 'W', 'sub_type': 'style'}, - \ {'type': 'I'}, + let g:ale_buffer_info = {bufnr(''): {}} + call ale#statusline#Update(bufnr(''), [ + \ {'bufnr': bufnr(''), 'type': 'E'}, + \ {'bufnr': bufnr(''), 'type': 'E', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'W'}, + \ {'bufnr': bufnr(''), 'type': 'W', 'sub_type': 'style'}, + \ {'bufnr': bufnr(''), 'type': 'I'}, \]) AssertEqual '2E 3W', ale#statusline#Status() Execute (Status() should return the custom 'OK' string with the old format): let g:ale_statusline_format = ['%sE', '%sW', 'OKIE'] - let g:ale_buffer_info = {bufnr('%'): {}} - call ale#statusline#Update(bufnr('%'), []) + let g:ale_buffer_info = {bufnr(''): {}} + call ale#statusline#Update(bufnr(''), []) AssertEqual 'OKIE', ale#statusline#Status() Execute(ale#statusline#Update shouldn't blow up when globals are undefined): |