]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/sign/test_sign_column_highlighting.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / sign / test_sign_column_highlighting.vader
1 Before:
2   Save g:ale_change_sign_column_color
3   Save &verbose
4
5   function! ParseHighlight(name) abort
6     redir => l:output
7       silent execute 'highlight ' . a:name
8     redir end
9
10     return substitute(join(split(l:output)[2:]), ' Last set.*', '', '')
11   endfunction
12
13   function! SetHighlight(name, syntax) abort
14     let l:match = matchlist(a:syntax, '\vlinks to (.+)$')
15
16     if !empty(l:match)
17       execute 'highlight link ' . a:name . ' ' . l:match[1]
18     else
19       execute 'highlight ' . a:name . ' ' a:syntax
20     endif
21   endfunction
22
23   let g:sign_highlight = ParseHighlight('SignColumn')
24
25 After:
26   Restore
27
28   delfunction ParseHighlight
29   call SetHighlight('SignColumn', g:sign_highlight)
30   delfunction SetHighlight
31   unlet! g:sign_highlight
32
33   call ale#sign#Clear()
34
35 Execute(The SignColumn highlight shouldn't be changed if the option is off):
36   let g:ale_change_sign_column_color = 0
37   let b:sign_highlight = ParseHighlight('SignColumn')
38
39   call ale#sign#SetSigns(bufnr(''), [
40   \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'},
41   \])
42   AssertEqual b:sign_highlight, ParseHighlight('SignColumn')
43
44   call ale#sign#SetSigns(bufnr(''), [])
45   AssertEqual b:sign_highlight, ParseHighlight('SignColumn')
46
47 Execute(The SignColumn highlight should be set and reset):
48   let g:ale_change_sign_column_color = 1
49
50   call ale#sign#SetSigns(bufnr(''), [
51   \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'},
52   \])
53   AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn')
54
55   call ale#sign#SetSigns(bufnr(''), [])
56   AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')
57
58 Execute(The SignColumn should be correctly parsed when verbose=1):
59   set verbose=1
60   highlight SignColumn ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey
61
62   call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight()
63
64   AssertEqual
65   \ has('nvim')
66   \   ? 'ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey'
67   \   : 'term=standout ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey',
68   \ ParseHighlight('ALESignColumnWithoutErrors')