summaryrefslogtreecommitdiff
path: root/test/test_ale_statusline.vader
blob: 68643a243a30f22e4762408878fac32d0f533b97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Before:
  let g:ale_buffer_loclist_map = {}

After:
  let g:ale_buffer_loclist_map = {}

Execute (Count should be 0 when data is empty):
  AssertEqual ale#statusline#Count(bufnr('%')), [0, 0]

Before:
  let g:ale_buffer_count_map = {'44': [1, 2]}

After:
  let g:ale_buffer_loclist_map = {}

Execute (Count should read data from the cache):
  AssertEqual ale#statusline#Count(44), [1, 2]

Execute (Update the cache with new data):
  call ale#statusline#Update(44, [])

Then (The cache should reflect the new data):
  AssertEqual ale#statusline#Count(44), [0, 0]

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 = {}

Execute (Count should be match the loclist):
  AssertEqual ale#statusline#Count(1), [1, 0]

Execute (Output should be empty for non-existant buffer):
  AssertEqual ale#statusline#Count(9001), [0, 0]

Before:
  let g:ale_statusline_format = ['%sE', '%sW', 'OKIE']

After:
  let g:ale_buffer_loclist_map = {}

Execute (Given some errors):
  call ale#statusline#Update(bufnr('%'), [{'type': 'E'}, {'type': 'E'}])

Then (Statusline is formatted to the users preference):
  AssertEqual ale#statusline#Status(), "2E"

Execute (Given some warnings):
  call ale#statusline#Update(bufnr('%'), [{'type': 'W'}, {'type': 'W'}, {'type': 'W'}])

Then (Statusline is formatted to the users preference):
  AssertEqual ale#statusline#Status(), "3W"

Execute (Given some warnings, and errors.):
  call ale#statusline#Update(bufnr('%'), [{'type': 'E'}, {'type': 'W'}, {'type': 'W'}])

Then (Statusline is formatted to the users preference):
  AssertEqual ale#statusline#Status(), "1E 2W"

Execute (Given a lack of data):
  call ale#statusline#Update(bufnr('%'), [])

Then (Statusline is formatted to the users preference):
  AssertEqual ale#statusline#Status(), 'OKIE'