This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/test_ale_statusline.vader

66 lines
1.9 KiB
Text
Raw Normal View History

2016-10-13 13:50:57 +00:00
Before:
let g:ale_buffer_loclist_map = {}
After:
let g:ale_buffer_loclist_map = {}
2016-10-13 13:50:57 +00:00
Execute (Count should be 0 when data is empty):
AssertEqual [0, 0], ale#statusline#Count(bufnr('%'))
2016-10-13 13:50:57 +00:00
Before:
let g:ale_buffer_count_map = {'44': [1, 2]}
After:
let g:ale_buffer_loclist_map = {}
2016-10-13 13:50:57 +00:00
Execute (Count should read data from the cache):
AssertEqual [1, 2], ale#statusline#Count(44)
2016-10-13 13:50:57 +00:00
Execute (Update the cache with new data):
call ale#statusline#Update(44, [])
2016-10-13 13:50:57 +00:00
Then (The cache should reflect the new data):
AssertEqual [0, 0], ale#statusline#Count(44)
2016-10-13 13:50:57 +00:00
Before:
let g:ale_buffer_loclist_map = {'1': [{'lnum': 1, 'bufnr': 1, 'vcol': 0, 'linter_name': 'testlinter', 'nr': -1, 'type': 'E', 'col': 1, 'text': 'Test Error'}]}
After:
let g:ale_buffer_loclist_map = {}
2016-10-13 13:50:57 +00:00
Execute (Count should be match the loclist):
AssertEqual [1, 0], ale#statusline#Count(1)
2016-10-13 13:50:57 +00:00
Execute (Output should be empty for non-existant buffer):
AssertEqual [0, 0], ale#statusline#Count(9001)
2016-10-13 13:50:57 +00:00
Before:
let g:ale_statusline_format = ['%sE', '%sW', 'OKIE']
After:
let g:ale_buffer_loclist_map = {}
2016-10-13 13:50:57 +00:00
Execute (Given some errors):
call ale#statusline#Update(bufnr('%'), [{'type': 'E'}, {'type': 'E'}])
2016-10-13 13:50:57 +00:00
Then (Statusline is formatted to the users preference):
AssertEqual '2E', ale#statusline#Status()
2016-10-13 13:50:57 +00:00
Execute (Given some warnings):
call ale#statusline#Update(bufnr('%'), [{'type': 'W'}, {'type': 'W'}, {'type': 'W'}])
2016-10-13 13:50:57 +00:00
Then (Statusline is formatted to the users preference):
AssertEqual '3W', ale#statusline#Status()
2016-10-13 13:50:57 +00:00
Execute (Given some warnings, and errors.):
call ale#statusline#Update(bufnr('%'), [{'type': 'E'}, {'type': 'W'}, {'type': 'W'}])
2016-10-13 13:50:57 +00:00
Then (Statusline is formatted to the users preference):
AssertEqual '1E 2W', ale#statusline#Status()
2016-10-13 13:50:57 +00:00
Execute (Given a lack of data):
call ale#statusline#Update(bufnr('%'), [])
2016-10-13 13:50:57 +00:00
Then (Statusline is formatted to the users preference):
AssertEqual 'OKIE', ale#statusline#Status()