spacevim/bundle/neomake/tests/highlights.vader
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

133 lines
4.2 KiB
Plaintext

Include: include/setup.vader
Execute (No error when matches are cleared manually):
new
call neomake#highlights#AddHighlight({'bufnr': bufnr('%'), 'type': 'E', 'col': 1, 'lnum': 1}, 'file')
if !has('nvim')
AssertEqual w:neomake_highlights, []
endif
doautocmd BufEnter
if !has('nvim')
AssertEqual len(w:neomake_highlights), 1
endif
call clearmatches()
" No-op in Neovim (same as BufEnter above), but should be defined.
call neomake#highlights#ShowHighlights()
if !has('nvim')
AssertEqual len(w:neomake_highlights), 1
AssertEqual w:neomake_highlights[0], getmatches()[0].id
if exists('*matchaddpos')
AssertEqual getmatches(),
\ [{'group': 'NeomakeError', 'id': 5, 'priority': 10, 'pos1': [1, 1, 1]}]
else
AssertEqual getmatches(),
\ [{'group': 'NeomakeError', 'pattern': '\%1l\%1c.\{1}', 'priority': 10, 'id': 5}]
endif
endif
bwipe
Execute (neomake#highlights#AddHighlight with off-columns):
" This documents the current behavior.
" I have tried to limit it to the length of the current line etc, but it
" seems to better use the given values as-is.
" Currently it will highlight an empty line completely, if there is an error
" reported for column 1.
new
let bufnr = bufnr('%')
let entry = {'bufnr': bufnr, 'type': 'E', 'col': 1, 'lnum': 1}
call neomake#highlights#AddHighlight(entry, 'file')
let highlights = neomake#highlights#_get()['file'][bufnr]
if !has('nvim')
AssertEqual highlights['NeomakeError'], [[1, 1, 1]]
endif
normal! ifoo
call neomake#highlights#ResetFile(bufnr)
call neomake#highlights#AddHighlight(entry, 'file')
let highlights = neomake#highlights#_get()['file'][bufnr]
if !has('nvim')
AssertEqual highlights['NeomakeError'], [[1, 1, 1]]
endif
call neomake#highlights#ResetFile(bufnr)
AssertEqual has_key(neomake#highlights#_get()['file'], bufnr), 0
let entry = {'bufnr': bufnr, 'type': 'E', 'col': 1, 'lnum': 1, 'length': 4}
call neomake#highlights#AddHighlight(entry, 'file')
let highlights = neomake#highlights#_get()['file'][bufnr]
if !has('nvim')
AssertEqual highlights['NeomakeError'], [[1, 1, 4]]
endif
bwipe!
Execute (neomake#highlights#AddHighlight handles entries with line=0, col=0):
Save g:neomake_highlight_lines
let entry = {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 0, 'col': 0}
lockvar entry
let g:neomake_highlight_lines = 0
call neomake#highlights#AddHighlight(entry, 'file')
let g:neomake_highlight_lines = 1
call neomake#highlights#AddHighlight(entry, 'file')
Execute (neomake#highlights#AddHighlight handles entries with line=0, col=1):
Save g:neomake_highlight_lines
let entry = {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 0, 'col': 1}
lockvar entry
let g:neomake_highlight_lines = 0
call neomake#highlights#AddHighlight(entry, 'file')
let g:neomake_highlight_lines = 1
call neomake#highlights#AddHighlight(entry, 'file')
Execute (neomake#highlights#AddHighlight: handles both col/line):
Save g:neomake_highlight_lines
Save g:neomake_highlight_columns
let g:neomake_highlight_columns = 1
let g:neomake_highlight_lines = 1
new
let bufnr = bufnr('%')
" Highlights column if present in entry.
let entry = {'bufnr': bufnr, 'type': 'E', 'col': 1, 'lnum': 1}
call neomake#highlights#AddHighlight(entry, 'file')
let highlights = neomake#highlights#_get()['file'][bufnr]
if !has('nvim')
AssertEqual highlights['NeomakeError'], [[1, 1, 1]]
endif
" Highlights line if column is not present in entry.
let entry = {'bufnr': bufnr, 'type': 'E', 'col': 0, 'lnum': 1}
call neomake#highlights#ResetFile(bufnr)
call neomake#highlights#AddHighlight(entry, 'file')
let highlights = neomake#highlights#_get()['file'][bufnr]
if !has('nvim')
AssertEqual highlights['NeomakeError'], [1]
endif
bwipe!
Execute (Highlights get (re-)defined on ColorScheme event):
if exists('g:colors_name')
let colorscheme = g:colors_name
let had_colorscheme = 1
else
let colorscheme = 'default'
let had_colorscheme = 0
endif
let orig = neomake#utils#redir('hi NeomakeError')
exe 'colorscheme' colorscheme
let new = neomake#utils#redir('hi NeomakeError')
if had_colorscheme
AssertEqual orig, new
else
Assert stridx(new, 'cleared') == -1, 'highlight is not cleared.'
endif