From cbed6f9a69a544990ede218fa24794152ac59534 Mon Sep 17 00:00:00 2001 From: itchyny Date: Mon, 21 Mar 2016 15:52:25 +0900 Subject: [PATCH] add more tests, the function returns void string, for s:expand --- test/expand.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/expand.vim b/test/expand.vim index b9d45d5..19cd766 100644 --- a/test/expand.vim +++ b/test/expand.vim @@ -67,6 +67,32 @@ function! s:suite.custom_type_string() 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(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! Custom() return 24