summaryrefslogtreecommitdiff
path: root/test/test_list_titles.vader
blob: e7295414a20776d5229c31fe95cbee91bc2725f8 (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
66
67
68
69
70
71
72
73
74
75
76
77
Before:
  Save g:ale_set_loclist
  Save g:ale_set_quickfix
  Save g:ale_buffer_info
  Save g:ale_set_lists_synchronously

  let g:ale_buffer_info = {}
  let g:ale_set_loclist = 0
  let g:ale_set_quickfix = 0
  let g:ale_set_lists_synchronously = 1

  call ale#test#SetDirectory('/testplugin/test')

After:
  Restore

  call setloclist(0, [])
  call setqflist([])

  call ale#test#RestoreDirectory()

Execute(The loclist titles should be set appropriately):
  silent noautocmd file foo

  let g:ale_set_loclist = 1

  call ale#list#SetLists(bufnr(''), [
  \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'},
  \])

  AssertEqual [{
  \ 'lnum': 5,
  \ 'bufnr': bufnr(''),
  \ 'col': 5,
  \ 'text': 'x',
  \ 'valid': 1,
  \ 'vcol': 0,
  \ 'nr': 0,
  \ 'type': 'E',
  \ 'pattern': '',
  \}], getloclist(0)

  if !has('nvim')
    AssertEqual
    \ {'title': ale#path#Winify(getcwd() . '/foo')},
    \ getloclist(0, {'title': ''})
  endif

Execute(The quickfix titles should be set appropriately):
  silent noautocmd file foo

  let g:ale_set_quickfix = 1

  let g:ale_buffer_info[bufnr('')] = {
  \ 'loclist': [{'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'}],
  \}

  call ale#list#SetLists(bufnr(''), [
  \ {'bufnr': bufnr(''), 'lnum': 5, 'col': 5, 'text': 'x', 'type': 'E'},
  \])
  AssertEqual [{
  \ 'lnum': 5,
  \ 'bufnr': bufnr(''),
  \ 'col': 5,
  \ 'text': 'x',
  \ 'valid': 1,
  \ 'vcol': 0,
  \ 'nr': 0,
  \ 'type': 'E',
  \ 'pattern': '',
  \}], getqflist()

  if !has('nvim')
    AssertEqual
    \ {'title': ale#path#Winify(getcwd() . '/foo')},
    \ getqflist({'title': ''})
  endif