add more tests, the function returns void string, for s:expand

This commit is contained in:
itchyny
2016-03-21 15:52:25 +09:00
parent a61e069274
commit cbed6f9a69

View File

@@ -67,6 +67,32 @@ function! s:suite.custom_type_string()
delfunction Custom delfunction Custom
endfunction 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(SID('expand')([['readonly', 'filename'], ['custom'], ['modified']]),
\ [[['readonly', 'filename'], [], ['modified']], [[0, 0], [], [0]], [0, 1, 2, 3]])
call s:assert.equals(SID('expand')([['readonly', 'filename', 'custom', 'modified']]),
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], [0, 1]])
delfunction Custom
endfunction
function! s:suite.custom_void_string()
function! Custom()
return ''
endfunction
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
call lightline#init()
call s:assert.equals(SID('expand')([['readonly', 'filename'], ['custom'], ['modified']]),
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], [0, 2, 3]])
call s:assert.equals(SID('expand')([['readonly', 'filename', 'custom', 'modified']]),
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], [0, 1]])
delfunction Custom
endfunction
function! s:suite.custom_number() function! s:suite.custom_number()
function! Custom() function! Custom()
return 24 return 24