summaryrefslogtreecommitdiff
path: root/test/test_results_not_cleared_when_opening_loclist.vader
blob: c983a89f92df650876aa671b5fdfd87542086369 (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
Before:
  Save g:ale_run_synchronously

  let g:ale_run_synchronously = 1

  function! TestCallback(buffer, output)
    return [
    \ {
    \   'lnum': 1,
    \   'text': 'Something is wrong',
    \ },
    \]
  endfunction

  call ale#linter#Define('foobar', {
  \ 'name': 'testlinter',
  \ 'callback': 'TestCallback',
  \ 'executable': has('win32') ? 'cmd' : 'true',
  \ 'command': 'true',
  \ 'read_buffer': 0,
  \})

After:
  Restore

  delfunction TestCallback
  let g:ale_buffer_info = {}
  call ale#linter#Reset()
  call setloclist(0, [])
  call clearmatches()
  sign unplace *

Given foobar (Some file):
  abc

Execute(The loclist shouldn't be cleared when opening the loclist):
  call ale#Lint()
  sleep 1ms

  AssertEqual 1, len(getloclist(0)), 'The loclist was never set'

  " The cleanup function is called when the loclist window is closed.
  " If some cleanup is done for this buffer, for which nothing is wrong,
  " then the loclist for the window, which is the same window as the window
  " we are checking, will be cleared.
  :lopen
  :q

  AssertEqual 1, len(getloclist(0)), 'The loclist was cleared'