summaryrefslogtreecommitdiff
path: root/test/sign/test_sign_column_highlighting.vader
blob: 81f80c906cac6cb66751d8382674986ab17b4d97 (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
Before:
  function! ParseHighlight(name) abort
    redir => l:output
      silent execute 'highlight ' . a:name
    redir end

    return join(split(l:output)[2:])
  endfunction

  function! SetHighlight(name, syntax) abort
    let l:match = matchlist(a:syntax, '\vlinks to (.+)$')

    if !empty(l:match)
      execute 'highlight link ' . a:name . ' ' . l:match[1]
    else
      execute 'highlight ' . a:name . ' ' a:syntax
    endif
  endfunction

  let g:sign_highlight = ParseHighlight('SignColumn')

After:
  delfunction ParseHighlight
  call SetHighlight('SignColumn', g:sign_highlight)
  delfunction SetHighlight
  unlet! g:sign_highlight

Execute(The SignColumn highlight should be set and reset):
  call ale#sign#SetSignColumnHighlight(1)
  AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn')

  call ale#sign#SetSignColumnHighlight(0)
  AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')

Execute(ALESignColumnWithoutErrors should link to what SignColumn links to):
  highlight clear SignColumn
  highlight link SignColumn LineNr
  highlight clear ALESignColumnWithoutErrors

  runtime 'autoload/ale/sign.vim'

  AssertEqual 'links to LineNr', ParseHighlight('ALESignColumnWithoutErrors')