aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/lightline.vim/test/expand.vim
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
committerKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
commite573b3020c032400eed60b649a2cbf55266e6bb0 (patch)
tree8f572394ac8433529c7a8e70d160a2fbe8268b4e /vim/bundle/lightline.vim/test/expand.vim
parentb8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff)
downloadmyconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip
Add current configurations from old repository
Diffstat (limited to 'vim/bundle/lightline.vim/test/expand.vim')
-rw-r--r--vim/bundle/lightline.vim/test/expand.vim612
1 files changed, 612 insertions, 0 deletions
diff --git a/vim/bundle/lightline.vim/test/expand.vim b/vim/bundle/lightline.vim/test/expand.vim
new file mode 100644
index 0000000..c2fc0ab
--- /dev/null
+++ b/vim/bundle/lightline.vim/test/expand.vim
@@ -0,0 +1,612 @@
+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.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', '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', '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', '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', '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', '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', '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', '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', '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', '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', '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_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