nvim/pack/acp/start/limelight.vim/test/limelight.vader

139 lines
2.3 KiB
Text

Execute (Setup):
Save g:colors_name, &background
colo seoul256
function! s:assert_on()
Assert exists('#limelight'), 'limelight should be on'
endfunction
function! s:assert_off()
Assert !exists('#limelight'), 'limelight should be off'
endfunction
command! AssertOn call s:assert_on()
command! AssertOff call s:assert_off()
Before:
unlet! g:limelight_default_coefficient
\ g:limelight_conceal_guifg g:limelight_conceal_ctermfg
Execute (Invalid argument type):
Limelight 'hello'
AssertOff
Limelight {}
AssertOff
Limelight []
AssertOff
Execute (Invalid argument range):
Limelight 1.2
AssertOff
Limelight 2
AssertOff
Limelight -0.2
AssertOff
Limelight -1
AssertOff
Execute (Limelight / Limelight!):
Limelight
AssertOn
Limelight
AssertOn
Limelight!
AssertOff
Limelight!
AssertOff
Limelight 0.5
AssertOn
Limelight!
AssertOff
Execute (Limelight!!):
Limelight!!
AssertOn
Limelight!!
AssertOff
Limelight!! 2.0
AssertOff
Limelight!! 0.9
AssertOn
Limelight!! 0.9
AssertOff
Execute (g:limelight_default_coefficient):
let g:limelight_default_coefficient = 2.0
Limelight
AssertOff
let g:limelight_default_coefficient = -1.0
Limelight
AssertOff
Execute (Unsupported terminal):
colo default
let &t_Co = 16
Limelight
AssertOff
Execute (Unsupported. but g:limelight_conceal_???fg defined):
if has('gui_running')
colo default
let g:limelight_conceal_guifg = '#cccccc'
Limelight
AssertOn
Limelight!
AssertOff
else
if exists('&termguicolors')
set notermguicolors
endif
colo default
let &t_Co = 256
" Cannot enable it without g:limelight_conceal_ctermfg
Limelight
AssertOff
let g:limelight_conceal_ctermfg = 240
Limelight
AssertOn
Limelight!
AssertOff
let g:limelight_conceal_ctermfg = 'red'
Limelight
AssertOn
Limelight!
AssertOff
endif
" However, you're still not allowed to pass argument to Limelight command
redir => msg
Limelight 0.5
redir END
AssertOff
Assert msg !~ 'g:limelight_conceal_', 'Invalid message: '.msg
Execute (TODO: Color interpolation):
Assert 0, 'TODO'
Execute (Cleanup):
delc AssertOn
delc AssertOff
unlet! msg
Restore
silent! execute 'colo '.g:colors_name