mirror of
https://github.com/amix/vimrc
synced 2025-07-12 14:15:00 +08:00
fix(install): fix install method
This commit is contained in:
24
.vim_runtime/sources_non_forked/lightline.vim/test/.themisrc
Normal file
24
.vim_runtime/sources_non_forked/lightline.vim/test/.themisrc
Normal file
@ -0,0 +1,24 @@
|
||||
let s:sids = {}
|
||||
function! s:sid(path) abort
|
||||
if has_key(s:sids, a:path)
|
||||
return s:sids[a:path]
|
||||
endif
|
||||
redir => scriptnames
|
||||
silent! scriptnames
|
||||
redir END
|
||||
for line in split(scriptnames, '\n')
|
||||
if line =~# a:path
|
||||
let sid = matchstr(line, '\v^\s*\zs\d+\ze')
|
||||
let s:sids[a:path] = sid
|
||||
return sid
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SID(name) abort
|
||||
return function(printf("\<SNR>%d_%s", s:sid('autoload/lightline.vim'), a:name))
|
||||
endfunction
|
||||
|
||||
filetype plugin on
|
||||
|
||||
call lightline#init()
|
@ -0,0 +1,23 @@
|
||||
if !has("patch-8.2.0996")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:suite = themis#suite('autocmd')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.doautoall()
|
||||
tabnew
|
||||
tabnew
|
||||
tabprevious
|
||||
doautoall WinEnter
|
||||
let statusline = getwinvar(1, '&statusline')
|
||||
call s:assert.match(statusline, 'lightline')
|
||||
call s:assert.match(statusline, '_active_')
|
||||
endfunction
|
@ -0,0 +1,90 @@
|
||||
let s:suite = themis#suite('concatenate')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = { 'subseparator': { 'left': '>', 'right': '<' } }
|
||||
call lightline#init()
|
||||
endfunction
|
||||
|
||||
function! s:suite.nil()
|
||||
call s:assert.equals(lightline#concatenate([], 0), '')
|
||||
call s:assert.equals(lightline#concatenate([], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.one()
|
||||
call s:assert.equals(lightline#concatenate(['foo'], 0), 'foo')
|
||||
call s:assert.equals(lightline#concatenate(['foo'], 1), 'foo')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two()
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar'], 0), 'foo > bar')
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar'], 1), 'foo < bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three()
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', 'baz'], 0), 'foo > bar > baz')
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', 'baz'], 1), 'foo < bar < baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.one_empty()
|
||||
call s:assert.equals(lightline#concatenate([''], 0), '')
|
||||
call s:assert.equals(lightline#concatenate([''], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_empty_left()
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar'], 0), 'bar')
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar'], 1), 'bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_empty_right()
|
||||
call s:assert.equals(lightline#concatenate(['foo', ''], 0), 'foo')
|
||||
call s:assert.equals(lightline#concatenate(['foo', ''], 1), 'foo')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_empty_both()
|
||||
call s:assert.equals(lightline#concatenate(['', ''], 0), '')
|
||||
call s:assert.equals(lightline#concatenate(['', ''], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_left()
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', 'baz'], 0), 'bar > baz')
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', 'baz'], 1), 'bar < baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_middle()
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', 'baz'], 0), 'foo > baz')
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', 'baz'], 1), 'foo < baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_right()
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', ''], 0), 'foo > bar')
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', ''], 1), 'foo < bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_middle_right()
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', ''], 0), 'foo')
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', ''], 1), 'foo')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_left_right()
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', ''], 0), 'bar')
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', ''], 1), 'bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_left_middle()
|
||||
call s:assert.equals(lightline#concatenate(['', '', 'baz'], 0), 'baz')
|
||||
call s:assert.equals(lightline#concatenate(['', '', 'baz'], 1), 'baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_all()
|
||||
call s:assert.equals(lightline#concatenate(['', '', ''], 0), '')
|
||||
call s:assert.equals(lightline#concatenate(['', '', ''], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.keep_original()
|
||||
let xs = ['', 'bar', '']
|
||||
call s:assert.equals(lightline#concatenate(xs, 0), 'bar')
|
||||
call s:assert.equals(xs, ['', 'bar', ''])
|
||||
call s:assert.equals(lightline#concatenate(xs, 1), 'bar')
|
||||
call s:assert.equals(xs, ['', 'bar', ''])
|
||||
endfunction
|
15
.vim_runtime/sources_non_forked/lightline.vim/test/error.vim
Normal file
15
.vim_runtime/sources_non_forked/lightline.vim/test/error.vim
Normal file
@ -0,0 +1,15 @@
|
||||
let s:suite = themis#suite('error')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:message() abort
|
||||
redir => messages
|
||||
silent! messages
|
||||
redir END
|
||||
return split(messages, '\n')[-1]
|
||||
endfunction
|
||||
|
||||
function! s:suite.error()
|
||||
let message = 'An error occurred.'
|
||||
call lightline#error(message)
|
||||
call s:assert.equals(s:message(), 'lightline.vim: ' . message)
|
||||
endfunction
|
667
.vim_runtime/sources_non_forked/lightline.vim/test/expand.vim
Normal file
667
.vim_runtime/sources_non_forked/lightline.vim/test/expand.vim
Normal file
@ -0,0 +1,667 @@
|
||||
let s:suite = themis#suite('expand')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:expand(...)
|
||||
return call(SID('expand'), a:000)
|
||||
endfunction
|
||||
|
||||
function! s:suite.expand()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([]),
|
||||
\ [[], [], ['0']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.default()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['mode', 'paste'], ['readonly', 'filename', 'modified']]),
|
||||
\ [[['mode', 'paste'], ['readonly', 'filename', 'modified']], [[0, 0], [0, 0, 0]], ['0', '1', '2']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.raw_type()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'raw' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [2, 2, 2], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 2, 2, 2, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.component_raw()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' }, 'component_raw': { 'custom': 1 } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [2], [2], [2], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 2], [2], [2, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.multiple()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['x0', 'x1', 'x2', 'y0', 'y1', 'y2', 'z0', 'z1', 'z2'], ['modified']], [[0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'x0', 'x1', 'x2', 'y0', 'y1', 'y2', 'z0', 'z1', 'z2', 'modified']], [[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.multiple_type()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'], ['modified']], [[0, 0], [1, 1, 1], [1, 1, 1], [1, 1, 1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2', 'modified']], [[0, 0, 1, 1, 1], [1, 1, 1], [1, 1, 1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.flatten()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle', 'right' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_flatten()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle', 'right' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_string()
|
||||
function! Custom()
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_string()
|
||||
function! Custom()
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string()
|
||||
function! Custom()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string()
|
||||
function! Custom()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_number()
|
||||
function! Custom()
|
||||
return 24
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', '24', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_number()
|
||||
function! Custom()
|
||||
return 24
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array()
|
||||
function! Custom()
|
||||
return ['', '', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array()
|
||||
function! Custom()
|
||||
return ['', '', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array_2()
|
||||
function! Custom()
|
||||
return [[''], [''], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array_2()
|
||||
function! Custom()
|
||||
return [[''], [''], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array_3()
|
||||
function! Custom()
|
||||
return ['', 'custom', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array_3()
|
||||
function! Custom()
|
||||
return ['', 'custom', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array_4()
|
||||
function! Custom()
|
||||
return [[''], ['custom'], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array_4()
|
||||
function! Custom()
|
||||
return [[''], ['custom'], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'z0', 'z1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename', 'y0', 'y1', 'z0', 'z1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['modified']], [[0], [1, 1], [1, 1], [0]], ['0', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1', 'modified']], [[0], [1, 1], [1, 1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0], [1, 1], [1, 1], [0]], ['0', '1', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1'], ['y0', 'y1'], ['modified']], [[0, 1, 1], [1, 1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_one()
|
||||
function! Custom()
|
||||
return [ 'left' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_one()
|
||||
function! Custom()
|
||||
return [ 'left' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_two()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle'], ['modified']], [[0, 0], [1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'modified']], [[0, 0, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_two()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['modified']], [[0, 0], [1], [1], [0]], ['0', '1', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['modified']], [[0, 0, 1], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_mixed()
|
||||
function! Custom()
|
||||
return ['left', { 'custom': 24 }, [function('tr')]]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', '{''custom'': 24}', 'function(''tr'')'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', '{''custom'': 24}', 'function(''tr'')', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_mixed()
|
||||
function! Custom()
|
||||
return ['left', { 'custom': 24 }, [function('tr')]]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['{''custom'': 24}'], ['function(''tr'')'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['{''custom'': 24}'], ['function(''tr'')', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_mixed_2()
|
||||
function! Custom()
|
||||
return [['left', ''], ['', { 'custom': 24 }, ''], [[function('tr')], '']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', '{''custom'': 24}', '[function(''tr'')]'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', '{''custom'': 24}', '[function(''tr'')]', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_mixed_2()
|
||||
function! Custom()
|
||||
return [['left', ''], ['', { 'custom': 24 }, ''], [[function('tr')], '']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['{''custom'': 24}'], ['[function(''tr'')]'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['{''custom'': 24}'], ['[function(''tr'')]', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_error()
|
||||
function! Custom()
|
||||
throw 'error'
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_error()
|
||||
function! Custom()
|
||||
throw 'error'
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.notfound()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'NotFound' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_notfound()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'NotFound' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_string()
|
||||
function! Custom()
|
||||
return 'custom'
|
||||
endfunction
|
||||
function! Modified()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom', 'modified': 'Modified' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['custom', 'custom'], []], [[0], [1, 1], []], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'custom', 'custom']], [[0, 1, 1]], ['0', '1']])
|
||||
delfunction Custom
|
||||
delfunction Modified
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'z0', 'z1', 'y0', 'y1', 'z0', 'z1'], ['modified']], [[0], [1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'y0', 'y1', 'z0', 'z1', 'y0', 'y1', 'z0', 'z1', 'modified']], [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['y0', 'y1'], ['z0', 'z1'], ['modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', 'custom', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['y0', 'y1'], ['z0', 'z1', 'modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1, 0]], ['0', 'custom', '0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1', 'y0', 'y1', 'x0', 'x1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1', 'y0', 'y1', 'x0', 'x1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1'], ['y0', 'y1'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', '1', 'custom', '1', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1'], ['y0', 'y1'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0, 1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', 'custom', '0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_both_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'y0', 'y1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_both_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_both_nil_left_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['custom', 'custom'], ['modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['0', '1', '2']])
|
||||
call s:assert.equals(s:expand([['custom', 'custom', 'modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1', 'modified']], [[1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_both_nil_left_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['custom', 'custom'], ['modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['custom', '1', '2']])
|
||||
call s:assert.equals(s:expand([['custom', 'custom', 'modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_both_nil_right_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', '1', '2']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom']]),
|
||||
\ [[['filename', 'y0', 'y1', 'y0', 'y1']], [[0, 1, 1, 1, 1]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_both_nil_right_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '2']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.dictionary_function()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'g:lightline.Custom' } }
|
||||
function! g:lightline.Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
endfunction
|
171
.vim_runtime/sources_non_forked/lightline.vim/test/highlight.vim
Normal file
171
.vim_runtime/sources_non_forked/lightline.vim/test/highlight.vim
Normal file
@ -0,0 +1,171 @@
|
||||
let s:suite = themis#suite('highlight')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
hi clear
|
||||
endfunction
|
||||
|
||||
function! s:hi(name)
|
||||
redir => hi
|
||||
silent! exec 'hi' a:name
|
||||
redir END
|
||||
return substitute(join(split(hi, "\n"), ''), ' \+', ' ', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:pattern(xs, ...) abort
|
||||
let ys = a:0 ? a:xs[1:] : a:xs
|
||||
let zs = get(a:000, 0, a:xs)
|
||||
return 'ctermfg=' . ys[2] . ' ctermbg=' . zs[3] . '.*guifg=' . ys[0] . ' guibg=' . zs[1]
|
||||
endfunction
|
||||
|
||||
function! s:suite.highlight()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_0'), s:pattern(palette.normal.left[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_1'), s:pattern(palette.normal.left[1]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineRight_normal_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_1'), s:pattern(palette.normal.right[1]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_2'), s:pattern(palette.normal.right[2]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.insert()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#highlight('insert')
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightlineLeft_insert_0'), s:pattern(palette.insert.left[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_insert_1'), s:pattern(palette.insert.left[1]))
|
||||
call s:assert.match(s:hi('LightlineLeft_insert_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineRight_insert_0'), s:pattern(palette.insert.right[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_insert_1'), s:pattern(palette.insert.right[1]))
|
||||
call s:assert.match(s:hi('LightlineRight_insert_2'), s:pattern(palette.insert.right[2]))
|
||||
call s:assert.match(s:hi('LightlineRight_insert_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_insert'), s:pattern(palette.insert.middle[0]))
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:suite.visual()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#highlight('visual')
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightlineLeft_visual_0'), s:pattern(palette.visual.left[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_visual_1'), s:pattern(palette.visual.left[1]))
|
||||
call s:assert.match(s:hi('LightlineLeft_visual_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineRight_visual_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_visual_1'), s:pattern(palette.normal.right[1]))
|
||||
call s:assert.match(s:hi('LightlineRight_visual_2'), s:pattern(palette.normal.right[2]))
|
||||
call s:assert.match(s:hi('LightlineRight_visual_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.replace()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#highlight('replace')
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightlineLeft_replace_0'), s:pattern(palette.replace.left[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_replace_1'), s:pattern(palette.replace.left[1]))
|
||||
call s:assert.match(s:hi('LightlineLeft_replace_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineRight_replace_0'), s:pattern(palette.replace.right[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_replace_1'), s:pattern(palette.replace.right[1]))
|
||||
call s:assert.match(s:hi('LightlineRight_replace_2'), s:pattern(palette.replace.right[2]))
|
||||
call s:assert.match(s:hi('LightlineRight_replace_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_replace'), s:pattern(palette.replace.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.left_right()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_0'), s:pattern(palette.normal.left[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_1'), s:pattern(palette.normal.left[1]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_2'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_3'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_4'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineRight_normal_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_1'), s:pattern(palette.normal.right[1]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_2'), s:pattern(palette.normal.right[2]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_3'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_4'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_5'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.no_components()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [],
|
||||
\ 'right': []
|
||||
\ },
|
||||
\ 'inactive': {
|
||||
\ 'left': [],
|
||||
\ 'right': []
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_0'), s:pattern(palette.normal.left[0]))
|
||||
call s:assert.match(s:hi('LightlineLeft_normal_1'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineRight_normal_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightlineRight_normal_1'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
for i in range(4)
|
||||
for j in range(5)
|
||||
if i + 1 == j
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', i, j)), s:pattern(get(palette.normal.left, i, palette.normal.middle[0]), get(palette.normal.left, j, palette.normal.middle[0])))
|
||||
else
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', i, j)), 'E411: highlight group not found\|cleared')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:suite.component_type()
|
||||
let g:lightline = { 'component_type': { 'error': 'error', 'warning': 'warning' } }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
for type in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s', type)), s:pattern(palette.normal[type][0]))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_0_%s', type)), s:pattern(palette.normal.left[0], palette.normal[type][0]))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_1_%s', type)), s:pattern(palette.normal.left[1], palette.normal[type][0]))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_2_%s', type)), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_0', type)), s:pattern(palette.normal[type][0], palette.normal.left[0]))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_1', type)), s:pattern(palette.normal[type][0], palette.normal.left[1]))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_2', type)), s:pattern(palette.normal[type][0], palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_3', type)), 'E411: highlight group not found\|cleared')
|
||||
endfor
|
||||
for type1 in ['error', 'warning']
|
||||
for type2 in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', type1, type2)), s:pattern(palette.normal[type1][0], palette.normal[type2][0]))
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
157
.vim_runtime/sources_non_forked/lightline.vim/test/link.vim
Normal file
157
.vim_runtime/sources_non_forked/lightline.vim/test/link.vim
Normal file
@ -0,0 +1,157 @@
|
||||
let s:suite = themis#suite('link')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
call s:clear()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
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)
|
||||
redir => hi
|
||||
silent! exec 'hi' a:name
|
||||
redir END
|
||||
return substitute(join(split(hi, "\n"), ''), ' \+', ' ', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:suite.link()
|
||||
call lightline#link()
|
||||
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_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_1'), 'LightlineRight_normal_1')
|
||||
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\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
|
||||
endfunction
|
||||
|
||||
function! s:suite.insert()
|
||||
call lightline#link('i')
|
||||
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_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_1'), 'LightlineRight_insert_1')
|
||||
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\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_insert')
|
||||
endfunction
|
||||
|
||||
function! s:suite.visual()
|
||||
call lightline#link('v')
|
||||
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_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_1'), 'LightlineRight_visual_1')
|
||||
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\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_visual')
|
||||
endfunction
|
||||
|
||||
function! s:suite.replace()
|
||||
call lightline#link('R')
|
||||
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_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_1'), 'LightlineRight_replace_1')
|
||||
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\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_replace')
|
||||
endfunction
|
||||
|
||||
function! s:suite.left_right()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#link()
|
||||
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_2'), 'LightlineLeft_normal_2')
|
||||
call s:assert.match(s:hi('LightlineLeft_active_3'), 'LightlineLeft_normal_3')
|
||||
call s:assert.match(s:hi('LightlineLeft_active_4'), 'E411: highlight group not found')
|
||||
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_2'), 'LightlineRight_normal_2')
|
||||
call s:assert.match(s:hi('LightlineRight_active_3'), 'LightlineRight_normal_3')
|
||||
call s:assert.match(s:hi('LightlineRight_active_4'), 'LightlineRight_normal_4')
|
||||
call s:assert.match(s:hi('LightlineRight_active_5'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#link()
|
||||
for i in range(4)
|
||||
for j in range(5)
|
||||
if i + 1 == j
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', i, j)), printf('LightlineLeft_normal_%s_%s', i, j))
|
||||
else
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', i, j)), 'E411: highlight group not found')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:suite.component_type()
|
||||
let g:lightline = { 'component_type': { 'error': 'error', 'warning': 'warning' } }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#link()
|
||||
for type in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s', type)), printf('LightlineLeft_normal_%s', type))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_0_%s', type)), printf('LightlineLeft_normal_0_%s', type))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_1_%s', type)), printf('LightlineLeft_normal_1_%s', type))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_2_%s', type)), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_0', type)), printf('LightlineLeft_normal_%s_0', type))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_1', type)), printf('LightlineLeft_normal_%s_1', type))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_2', type)), printf('LightlineLeft_normal_%s_2', type))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_3', type)), 'E411: highlight group not found')
|
||||
endfor
|
||||
for type1 in ['error', 'warning']
|
||||
for type2 in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', type1, type2)), printf('LightlineLeft_normal_%s_%s', type1, type2))
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:suite.hi_clear()
|
||||
call lightline#link()
|
||||
colorscheme default
|
||||
call lightline#link()
|
||||
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_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_1'), 'LightlineRight_normal_1')
|
||||
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\|cleared')
|
||||
call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal')
|
||||
endfunction
|
14
.vim_runtime/sources_non_forked/lightline.vim/test/mode.vim
Normal file
14
.vim_runtime/sources_non_forked/lightline.vim/test/mode.vim
Normal file
@ -0,0 +1,14 @@
|
||||
let s:suite = themis#suite('mode')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.mode()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#mode(), 'NORMAL')
|
||||
endfunction
|
||||
|
||||
function! s:suite.mode_map()
|
||||
let g:lightline = { 'mode_map': { 'n': 'N' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#mode(), 'N')
|
||||
endfunction
|
@ -0,0 +1,98 @@
|
||||
let s:suite = themis#suite('onetab')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.onetab()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew()
|
||||
tabnew
|
||||
call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew()
|
||||
tabnew
|
||||
tabnew
|
||||
call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 0), '2 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(3, 1), '3 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.modified()
|
||||
call append(0, '')
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name] +')
|
||||
undo
|
||||
endfunction
|
||||
|
||||
function! s:suite.filename()
|
||||
edit test
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 test')
|
||||
tabnew
|
||||
bunload test
|
||||
endfunction
|
||||
|
||||
function! s:suite.filename_modified()
|
||||
edit test
|
||||
call append(0, '')
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 test +')
|
||||
tabnew
|
||||
bunload! test
|
||||
endfunction
|
||||
|
||||
function! s:suite.active_inactive()
|
||||
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'filename' ], 'inactive': [ 'filename' ] } }
|
||||
call lightline#init()
|
||||
edit test
|
||||
call append(0, '')
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 test')
|
||||
call s:assert.equals(lightline#onetab(1, 0), 'test')
|
||||
tabnew
|
||||
bunload! test
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component()
|
||||
let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), 'custom')
|
||||
call s:assert.equals(lightline#onetab(2, 1), 'custom')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_function()
|
||||
function! Custom(n)
|
||||
return 'custom: ' . a:n
|
||||
endfunction
|
||||
let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component_function': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), 'custom: 1')
|
||||
call s:assert.equals(lightline#onetab(2, 1), 'custom: 2')
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_empty_middle()
|
||||
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom', 'filename' ], 'inactive': [ 'tabnum', 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_empty_left()
|
||||
let g:lightline = { 'tab': { 'active': [ 'custom', 'filename' ], 'inactive': [ 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '[No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '[No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_empty_middle()
|
||||
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom' ], 'inactive': [ 'tabnum', 'custom', 'custom' ] }, 'tab_component': { 'custom': '' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '2')
|
||||
endfunction
|
19
.vim_runtime/sources_non_forked/lightline.vim/test/popup.vim
Normal file
19
.vim_runtime/sources_non_forked/lightline.vim/test/popup.vim
Normal file
@ -0,0 +1,19 @@
|
||||
if !exists('*popup_menu') || !exists('*win_execute')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:suite = themis#suite('popup')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.win_execute_setfiletype()
|
||||
let id = popup_menu(['aaa', 'bbb'], {})
|
||||
call win_execute(id, 'setfiletype vim')
|
||||
call popup_close(id)
|
||||
endfunction
|
@ -0,0 +1,25 @@
|
||||
let s:suite = themis#suite('quickfix')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.quickfix_statusline()
|
||||
call setloclist(winnr(), [])
|
||||
lopen
|
||||
wincmd p
|
||||
call setloclist(winnr(), [])
|
||||
for n in range(1, winnr('$'))
|
||||
let statusline = getwinvar(n, '&statusline')
|
||||
call s:assert.match(statusline, 'lightline')
|
||||
if has('patch-8.1.1715')
|
||||
call s:assert.match(statusline, n == 1 ? '_active_' : '_inactive_')
|
||||
else
|
||||
call s:assert.match(statusline, n != 1 ? '_active_' : '_inactive_')
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
@ -0,0 +1,407 @@
|
||||
let s:suite = themis#suite('subseparator')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:subseparator(...)
|
||||
return eval(substitute(call(SID('subseparator'), a:000), '^%{\|}$', '', 'g'))
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_1()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_2()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '0', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_3()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_4()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_5()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '0', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_6()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1||0', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_7()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1||1', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_1()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_3()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_4()
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_5()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_6()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_7()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_1()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_3()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_4()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_5()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_6()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_7()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 1]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 1]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand_1()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1' }, 'component_function': { 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2' }, 'component_function': { 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand_3()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2' }, 'component_expand': { 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 1]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_not_found()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_not_found_1()
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom2': 'Custom2' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom2
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_not_found_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
endfunction
|
@ -0,0 +1,67 @@
|
||||
let s:suite = themis#suite('tabline')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabline()
|
||||
call s:assert.equals(&tabline, '%!lightline#tabline()')
|
||||
endfunction
|
||||
|
||||
function! s:suite.enabled()
|
||||
let g:lightline = { 'enable': { 'tabline': 1 } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(&tabline, '%!lightline#tabline()')
|
||||
endfunction
|
||||
|
||||
function! s:suite.disabled()
|
||||
let g:lightline = { 'enable': { 'tabline': 0 } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew()
|
||||
let tabline = lightline#tabline()
|
||||
tabnew
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_first()
|
||||
let tabline = lightline#tabline()
|
||||
0tabnew
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnext()
|
||||
tabnew
|
||||
let tabline = lightline#tabline()
|
||||
tabnext
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabonly()
|
||||
tabnew
|
||||
tabfirst
|
||||
let tabline = lightline#tabline()
|
||||
tabonly
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabclose()
|
||||
tabnew
|
||||
let tabline = lightline#tabline()
|
||||
tabclose
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabclose_last()
|
||||
tabnew
|
||||
tabfirst
|
||||
let tabline = lightline#tabline()
|
||||
$tabclose
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
99
.vim_runtime/sources_non_forked/lightline.vim/test/tabs.vim
Normal file
99
.vim_runtime/sources_non_forked/lightline.vim/test/tabs.vim
Normal file
@ -0,0 +1,99 @@
|
||||
let s:suite = themis#suite('tabs')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
set columns=180
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:tab(number, ...) abort
|
||||
let active = get(a:000, 0, 0)
|
||||
let last = get(a:000, 1, 0)
|
||||
return '%' . a:number . 'T%{lightline#onetab(' . a:number . ',' . active . ')}' . (last ? '%T' : '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabs()
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew()
|
||||
tabnew
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew()
|
||||
tabnew
|
||||
tabnew
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2)], [s:tab(3, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabfirst()
|
||||
tabnew
|
||||
tabfirst
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew_tabfirst()
|
||||
tabnew
|
||||
tabnew
|
||||
tabfirst
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2), s:tab(3, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew_tabprevious()
|
||||
tabnew
|
||||
tabnew
|
||||
tabprevious
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1)], [s:tab(3, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), s:tab(4), '...', s:tab(16), s:tab(17), s:tab(18), s:tab(19)], [s:tab(20, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabfirst()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabfirst
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2), s:tab(3), s:tab(4), '%<' . s:tab(5), '...', '%<' . s:tab(17), '%<' . s:tab(18), '%<' . s:tab(19), '%<' . s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabfirst_tabnext()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabfirst
|
||||
tabnext
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1)], [s:tab(3), s:tab(4), s:tab(5), '%<' . s:tab(6), '...', '%<' . s:tab(18), '%<' . s:tab(19), '%<' . s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabnext_10()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabnext 10
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), '...', s:tab(8), s:tab(9)], [s:tab(10, 1)], [s:tab(11), s:tab(12), '...', '%<' . s:tab(19), '%<' . s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabprevious()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabprevious
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), '...', s:tab(15), s:tab(16), s:tab(17), s:tab(18)], [s:tab(19, 1)], [s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabprevious_tabprevious()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabprevious
|
||||
tabprevious
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), '...', s:tab(15), s:tab(16), s:tab(17)], [s:tab(18, 1)], [s:tab(19), s:tab(20, 0, 1)]])
|
||||
endfunction
|
@ -0,0 +1,51 @@
|
||||
let s:suite = themis#suite('toggle')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.default()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.disable_enable()
|
||||
call lightline#disable()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#update()
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#enable()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
call lightline#disable()
|
||||
call lightline#disable()
|
||||
call lightline#enable()
|
||||
call lightline#enable()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
endfunction
|
||||
|
||||
function! s:suite.toggle()
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&statusline, '')
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&statusline, '')
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
46
.vim_runtime/sources_non_forked/lightline.vim/test/uniq.vim
Normal file
46
.vim_runtime/sources_non_forked/lightline.vim/test/uniq.vim
Normal file
@ -0,0 +1,46 @@
|
||||
let s:suite = themis#suite('uniq')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:uniq(...)
|
||||
try
|
||||
return call(SID('uniq'), a:000)
|
||||
catch
|
||||
return call(function('uniq'), a:000)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:suite.nil()
|
||||
call s:assert.equals(s:uniq([]), [])
|
||||
endfunction
|
||||
|
||||
function! s:suite.one()
|
||||
call s:assert.equals(s:uniq(['foo']), ['foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.two()
|
||||
call s:assert.equals(s:uniq(['foo', 'bar']), ['foo', 'bar'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.three()
|
||||
call s:assert.equals(s:uniq(['foo', 'bar', 'baz']), ['foo', 'bar', 'baz'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_duplicated()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo']), ['foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_duplicated()
|
||||
call s:assert.equals(s:uniq(['foo', 'bar', 'foo']), ['foo', 'bar', 'foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.many1()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo', 'bar', 'baz', 'baz', 'qux', 'foo']), ['foo', 'bar', 'baz', 'qux', 'foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.many2()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo', 'foo', 'foo', 'bar', 'bar', 'bar']), ['foo', 'bar'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.many3()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo', 'bar', 'bar', 'bar', 'foo', 'foo', 'foo']), ['foo', 'bar', 'foo'])
|
||||
endfunction
|
Reference in New Issue
Block a user