From 06d0dd33d3cae36ae1c400a1612ce38e409eb2b7 Mon Sep 17 00:00:00 2001 From: itchyny Date: Sun, 4 Sep 2016 13:07:31 +0900 Subject: [PATCH] add a test using dictionary function for expand components (ref #183) --- test/expand.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/expand.vim b/test/expand.vim index c2fc0ab..37804ee 100644 --- a/test/expand.vim +++ b/test/expand.vim @@ -610,3 +610,15 @@ function! s:suite.duplicated_type_both_nil_right_most() \ [[['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