summaryrefslogtreecommitdiff
path: root/test/test_list_titles.vader
blob: 1f0b2308bf1840317c47f1de5e2728271284fc0d (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': '',
  \}], ale#test#GetLoclistWithoutModule()

  if !has('nvim')
    AssertEqual
    \ {'title': ale#path#Simplify(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': '',
  \}], ale#test#GetQflistWithoutModule()

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