]> git.madduck.net Git - etc/vim.git/blobdiff - .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
diff --git a/.vim/bundle/ale/test/sign/test_sign_column_highlighting.vader b/.vim/bundle/ale/test/sign/test_sign_column_highlighting.vader
new file mode 100644 (file)
index 0000000..7ea5eb0
--- /dev/null
@@ -0,0 +1,68 @@
+Before:
+  Save g:ale_change_sign_column_color
+  Save &verbose
+
+  function! ParseHighlight(name) abort
+    redir => l:output
+      silent execute 'highlight ' . a:name
+    redir end
+
+    return substitute(join(split(l:output)[2:]), ' Last set.*', '', '')
+  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:
+  Restore
+
+  delfunction ParseHighlight
+  call SetHighlight('SignColumn', g:sign_highlight)
+  delfunction SetHighlight
+  unlet! g:sign_highlight
+
+  call ale#sign#Clear()
+
+Execute(The SignColumn highlight shouldn't be changed if the option is off):
+  let g:ale_change_sign_column_color = 0
+  let b:sign_highlight = ParseHighlight('SignColumn')
+
+  call ale#sign#SetSigns(bufnr(''), [
+  \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'},
+  \])
+  AssertEqual b:sign_highlight, ParseHighlight('SignColumn')
+
+  call ale#sign#SetSigns(bufnr(''), [])
+  AssertEqual b:sign_highlight, ParseHighlight('SignColumn')
+
+Execute(The SignColumn highlight should be set and reset):
+  let g:ale_change_sign_column_color = 1
+
+  call ale#sign#SetSigns(bufnr(''), [
+  \ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'W', 'text': 'x'},
+  \])
+  AssertEqual 'links to ALESignColumnWithErrors', ParseHighlight('SignColumn')
+
+  call ale#sign#SetSigns(bufnr(''), [])
+  AssertEqual 'links to ALESignColumnWithoutErrors', ParseHighlight('SignColumn')
+
+Execute(The SignColumn should be correctly parsed when verbose=1):
+  set verbose=1
+  highlight SignColumn ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey
+
+  call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight()
+
+  AssertEqual
+  \ has('nvim')
+  \   ? 'ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey'
+  \   : 'term=standout ctermfg=246 ctermbg=7 guifg=#839496 guibg=Grey',
+  \ ParseHighlight('ALESignColumnWithoutErrors')