mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-17 07:53:41 -05:00
clear highlight links before each highlight link tests
This commit is contained in:
@@ -2,12 +2,24 @@ let s:suite = themis#suite('link')
|
|||||||
let s:assert = themis#helper('assert')
|
let s:assert = themis#helper('assert')
|
||||||
|
|
||||||
function! s:suite.before_each()
|
function! s:suite.before_each()
|
||||||
hi clear
|
call s:clear()
|
||||||
let g:lightline = {}
|
let g:lightline = {}
|
||||||
call lightline#init()
|
call lightline#init()
|
||||||
call lightline#colorscheme()
|
call lightline#colorscheme()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:clear()
|
||||||
|
hi clear
|
||||||
|
redir => hi
|
||||||
|
silent! hi
|
||||||
|
redir END
|
||||||
|
for line in split(hi, '\n')
|
||||||
|
if match(line, 'links to') > 0
|
||||||
|
exec 'hi link' matchstr(line, '^\S*') 'NONE'
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:hi(name)
|
function! s:hi(name)
|
||||||
redir => hi
|
redir => hi
|
||||||
silent! exec 'hi' a:name
|
silent! exec 'hi' a:name
|
||||||
@@ -19,11 +31,11 @@ function! s:suite.link()
|
|||||||
call lightline#link()
|
call lightline#link()
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0')
|
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1')
|
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0')
|
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1')
|
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2')
|
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
|
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -31,11 +43,11 @@ function! s:suite.insert()
|
|||||||
call lightline#link('i')
|
call lightline#link('i')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_insert_0')
|
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_insert_0')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_insert_1')
|
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_insert_1')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_insert_0')
|
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_insert_0')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_insert_1')
|
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_insert_1')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_insert_2')
|
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_insert_2')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_insert')
|
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_insert')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -43,11 +55,11 @@ function! s:suite.visual()
|
|||||||
call lightline#link('v')
|
call lightline#link('v')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_visual_0')
|
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_visual_0')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_visual_1')
|
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_visual_1')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_visual_0')
|
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_visual_0')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_visual_1')
|
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_visual_1')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_visual_2')
|
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_visual_2')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_visual')
|
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_visual')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -55,11 +67,11 @@ function! s:suite.replace()
|
|||||||
call lightline#link('R')
|
call lightline#link('R')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_replace_0')
|
call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_replace_0')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_replace_1')
|
call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_replace_1')
|
||||||
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_replace_0')
|
call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_replace_0')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_replace_1')
|
call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_replace_1')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_replace_2')
|
call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_replace_2')
|
||||||
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found')
|
call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared')
|
||||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_replace')
|
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_replace')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user