I broke up with neovim....vim is my best friend now
This commit is contained in:
64
dot_vim/plugged/vim-airline/test/airline.vimspec
Normal file
64
dot_vim/plugged/vim-airline/test/airline.vimspec
Normal file
@@ -0,0 +1,64 @@
|
||||
Describe airline.vim
|
||||
Before
|
||||
let g:airline_statusline_funcrefs = []
|
||||
End
|
||||
|
||||
It should run user funcrefs first
|
||||
call airline#add_statusline_func('MyFuncref')
|
||||
let &statusline = ''
|
||||
call airline#update_statusline()
|
||||
Assert Match(airline#statusline(1), 'hello world')
|
||||
End
|
||||
|
||||
It should not change the statusline with -1
|
||||
call airline#add_statusline_funcref(function('MyIgnoreFuncref'))
|
||||
let &statusline = 'foo'
|
||||
call airline#update_statusline()
|
||||
Assert Equals(&statusline, 'foo')
|
||||
End
|
||||
|
||||
It should support multiple chained funcrefs
|
||||
call airline#add_statusline_func('MyAppend1')
|
||||
call airline#add_statusline_func('MyAppend2')
|
||||
call airline#update_statusline()
|
||||
Assert Match(airline#statusline(1), 'helloworld')
|
||||
End
|
||||
|
||||
It should allow users to redefine sections
|
||||
let g:airline_section_a = airline#section#create(['mode', 'mode'])
|
||||
call airline#update_statusline()
|
||||
Assert Match(airline#statusline(1), '%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#%#airline_a_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#')
|
||||
End
|
||||
|
||||
It should remove funcrefs properly
|
||||
let c = len(g:airline_statusline_funcrefs)
|
||||
call airline#add_statusline_func('MyIgnoreFuncref')
|
||||
call airline#remove_statusline_func('MyIgnoreFuncref')
|
||||
Assert Equals(len(g:airline_statusline_funcrefs), c)
|
||||
End
|
||||
|
||||
It should overwrite the statusline with active and inactive splits
|
||||
wincmd s
|
||||
Assert NotMatch(airline#statusline(1), 'inactive')
|
||||
Assert Match(airline#statusline(2), 'inactive')
|
||||
wincmd c
|
||||
End
|
||||
|
||||
It should collapse the inactive split if the variable is set true
|
||||
let g:airline_inactive_collapse = 1
|
||||
wincmd s
|
||||
Assert NotMatch(getwinvar(2, '&statusline'), 'airline#parts#mode')
|
||||
wincmd c
|
||||
end
|
||||
|
||||
It should collapse the inactive split if the variable is set false
|
||||
let g:airline_inactive_collapse = 0
|
||||
wincmd s
|
||||
Assert NotEquals(getwinvar(2, '&statusline'), 'airline#parts#mode')
|
||||
wincmd c
|
||||
End
|
||||
|
||||
It should include check_mode
|
||||
Assert Match(airline#statusline(1), 'airline#check_mode')
|
||||
End
|
||||
End
|
||||
107
dot_vim/plugged/vim-airline/test/builder.vimspec
Normal file
107
dot_vim/plugged/vim-airline/test/builder.vimspec
Normal file
@@ -0,0 +1,107 @@
|
||||
Describe builder.vim
|
||||
Describe active builder
|
||||
Before each
|
||||
let s:builder = airline#builder#new({'active': 1})
|
||||
End
|
||||
|
||||
It should start with an empty statusline
|
||||
let stl = s:builder.build()
|
||||
Assert Equals(stl, '')
|
||||
End
|
||||
|
||||
It should transition colors from one to the next
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl,'%#Normal#hello%#Normal_to_Search#%#Search#world')
|
||||
End
|
||||
|
||||
|
||||
It should reuse highlight group if background colors match
|
||||
highlight Foo1 ctermfg=1 ctermbg=2
|
||||
highlight Foo2 ctermfg=1 ctermbg=2
|
||||
call s:builder.add_section('Foo1', 'hello')
|
||||
call s:builder.add_section('Foo2', 'world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%#Foo1#helloworld')
|
||||
End
|
||||
|
||||
|
||||
It should switch highlight groups if foreground colors differ
|
||||
highlight Foo1 ctermfg=1 ctermbg=2
|
||||
highlight Foo2 ctermfg=2 ctermbg=2
|
||||
call s:builder.add_section('Foo1', 'hello')
|
||||
call s:builder.add_section('Foo2', 'world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%#Foo1#hello%#Foo1_to_Foo2#%#Foo2#world')
|
||||
End
|
||||
|
||||
It should split left/right sections
|
||||
call s:builder.split()
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%=')
|
||||
End
|
||||
|
||||
It after split, sections use the right separator
|
||||
call s:builder.split()
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'hello%#Normal_to_Search#%#Search#world')
|
||||
End
|
||||
|
||||
It should not repeat the same highlight group
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%#Normal#hellohello')
|
||||
End
|
||||
|
||||
It should replace accent groups with the specified group
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%#Normal#%#Normal_foo#hello')
|
||||
End
|
||||
|
||||
It should replace two accent groups with correct groups
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%#Normal_foo#hello%#Normal_bar#world')
|
||||
End
|
||||
|
||||
It should special restore group should go back to previous group
|
||||
call s:builder.add_section('Normal', '%#__restore__#')
|
||||
let stl = s:builder.build()
|
||||
Assert NotMatch(stl, '%#__restore__#')
|
||||
Assert Match(stl, '%#Normal#')
|
||||
End
|
||||
|
||||
It should blend colors from the left through the split to the right
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.split()
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'Normal_to_Search')
|
||||
End
|
||||
End
|
||||
|
||||
Describe inactive builder
|
||||
Before each
|
||||
let s:builder = airline#builder#new({'active': 0})
|
||||
End
|
||||
|
||||
It should transition colors from one to the next
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Search', 'world')
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, '%#Normal_inactive#hello%#Normal_to_Search_inactive#%#Search_inactive#world')
|
||||
End
|
||||
|
||||
It should not render accents
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world')
|
||||
let stl = s:builder.build()
|
||||
Assert Equals(stl, '%#Normal_inactive#hello%#foo_inactive#fooworld')
|
||||
End
|
||||
End
|
||||
|
||||
End
|
||||
50
dot_vim/plugged/vim-airline/test/commands.vimspec
Normal file
50
dot_vim/plugged/vim-airline/test/commands.vimspec
Normal file
@@ -0,0 +1,50 @@
|
||||
Describe commands.vim
|
||||
|
||||
It should toggle off and on
|
||||
execute 'AirlineToggle'
|
||||
Assert False(exists('#airline'))
|
||||
execute 'AirlineToggle'
|
||||
Assert True(exists('#airline'))
|
||||
End
|
||||
|
||||
It should toggle whitespace off
|
||||
call airline#extensions#load()
|
||||
execute 'AirlineToggleWhitespace'
|
||||
Assert False(exists('#airline_whitespace'))
|
||||
End
|
||||
|
||||
It should toggle whitespace on
|
||||
call airline#extensions#load()
|
||||
execute 'AirlineToggleWhitespace'
|
||||
Assert True(exists('#airline_whitespace'))
|
||||
End
|
||||
|
||||
It should display theme name "simple"
|
||||
execute 'AirlineTheme simple'
|
||||
Assert Equals(g:airline_theme, 'simple')
|
||||
End
|
||||
|
||||
It should display theme name "dark"'
|
||||
execute 'AirlineTheme dark'
|
||||
Assert Equals(g:airline_theme, 'dark')
|
||||
End
|
||||
|
||||
It should display theme name "dark" because specifying a name that does not exist
|
||||
execute 'AirlineTheme doesnotexist'
|
||||
Assert Equals(g:airline_theme, 'dark')
|
||||
End
|
||||
|
||||
It should display theme name molokai
|
||||
colors molokai
|
||||
Assert Equals(g:airline_theme, 'molokai')
|
||||
End
|
||||
|
||||
It should have a refresh command
|
||||
Assert Equals(exists(':AirlineRefresh'), 2)
|
||||
End
|
||||
|
||||
It should have a extensions command
|
||||
Assert Equals(exists(':AirlineExtensions'), 2)
|
||||
End
|
||||
|
||||
End
|
||||
28
dot_vim/plugged/vim-airline/test/dot_themisrc
Normal file
28
dot_vim/plugged/vim-airline/test/dot_themisrc
Normal file
@@ -0,0 +1,28 @@
|
||||
let s:helper = themis#helper('assert')
|
||||
let s:deps = themis#helper('deps')
|
||||
|
||||
call themis#helper('command').with(s:helper)
|
||||
call s:deps.git('vim-airline/vim-airline-themes')
|
||||
call s:deps.git('tomasr/molokai')
|
||||
|
||||
function! MyFuncref(...)
|
||||
call a:1.add_raw('hello world')
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! MyIgnoreFuncref(...)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! MyAppend1(...)
|
||||
call a:1.add_raw('hello')
|
||||
endfunction
|
||||
|
||||
function! MyAppend2(...)
|
||||
call a:1.add_raw('world')
|
||||
endfunction
|
||||
|
||||
let g:airline#extensions#default#layout = [
|
||||
\ [ 'c', 'a', 'b', 'warning' ],
|
||||
\ [ 'x', 'z', 'y' ]
|
||||
\ ]
|
||||
47
dot_vim/plugged/vim-airline/test/extensions_default.vimspec
Normal file
47
dot_vim/plugged/vim-airline/test/extensions_default.vimspec
Normal file
@@ -0,0 +1,47 @@
|
||||
Describe extensions_default.vim
|
||||
Before
|
||||
let g:airline#extensions#default#layout = [
|
||||
\ [ 'c', 'a', 'b', 'warning' ],
|
||||
\ [ 'x', 'z', 'y' ]
|
||||
\ ]
|
||||
|
||||
let s:builder = airline#builder#new({'active': 1})
|
||||
End
|
||||
|
||||
It should use the layout airline_a_to_airline_b
|
||||
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'airline_c_to_airline_a')
|
||||
end
|
||||
|
||||
It should use the layout airline_a_to_airline_b
|
||||
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'airline_a_to_airline_b')
|
||||
End
|
||||
|
||||
It should use the layout airline_b_to_airline_warning
|
||||
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'airline_b_to_airline_warning')
|
||||
end
|
||||
|
||||
it should use the layout airline_x_to_airline_z
|
||||
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'airline_x_to_airline_z')
|
||||
end
|
||||
|
||||
it should use the layout airline_z_to_airline_y
|
||||
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
|
||||
let stl = s:builder.build()
|
||||
Assert Match(stl, 'airline_z_to_airline_y')
|
||||
end
|
||||
|
||||
it should only render warning section in active splits
|
||||
wincmd s
|
||||
Assert Match(airline#statusline(1), 'warning')
|
||||
Assert NotMatch(airline#statusline(2), 'warning')
|
||||
wincmd c
|
||||
end
|
||||
end
|
||||
14
dot_vim/plugged/vim-airline/test/extensions_tabline.vimspec
Normal file
14
dot_vim/plugged/vim-airline/test/extensions_tabline.vimspec
Normal file
@@ -0,0 +1,14 @@
|
||||
Describe extensions_tabline.vim
|
||||
|
||||
It should use a tabline
|
||||
e! file1
|
||||
Assert Match(airline#extensions#tabline#get(), '%#airline_tabsel# %(%{airline#extensions#tabline#get_buffer_name(\d)}%) |%=%#airline_tabfill_to_airline_tabfill#%#airline_tabfill# buffers' )
|
||||
End
|
||||
|
||||
It Trigger on BufDelete autocommands
|
||||
e! file1
|
||||
sp file2
|
||||
bd
|
||||
Assert Match(airline#extensions#tabline#get(), '%#airline_tabsel# %(%{airline#extensions#tabline#get_buffer_name(\d)}%) |%=%#airline_tabfill_to_airline_tabfill#%#airline_tabfill# buffers' )
|
||||
End
|
||||
End
|
||||
28
dot_vim/plugged/vim-airline/test/highlighter.vimspec
Normal file
28
dot_vim/plugged/vim-airline/test/highlighter.vimspec
Normal file
@@ -0,0 +1,28 @@
|
||||
Describe highlighter.vim
|
||||
It should create separator highlight groups
|
||||
hi highlighter1 ctermfg=1 ctermbg=2
|
||||
hi highlighter2 ctermfg=3 ctermbg=4
|
||||
call airline#highlighter#add_separator('highlighter1', 'highlighter2', 0)
|
||||
let hl = airline#highlighter#get_highlight('highlighter1_to_highlighter2')
|
||||
Assert Equal([ 'NONE', 'NONE', '4', '2', '' ], hl)
|
||||
End
|
||||
|
||||
if exists("+termguicolors")
|
||||
It should create separator highlight groups with termguicolors
|
||||
set termguicolors
|
||||
hi highlighter1 guifg=#cd0000 guibg=#00cd00 ctermfg=1 ctermbg=2
|
||||
hi highlighter2 guifg=#cdcd00 guibg=#0000ee ctermfg=3 ctermbg=4
|
||||
call airline#highlighter#add_separator('highlighter1', 'highlighter2', 0)
|
||||
let hl = airline#highlighter#get_highlight('highlighter1_to_highlighter2')
|
||||
Assert Equal(['#0000ee', '#00cd00', '4', '2', '' ], hl)
|
||||
End
|
||||
endif
|
||||
|
||||
It should populate accent colors
|
||||
Assert False(exists('g:airline#themes#dark#palette.normal.airline_c_red'))
|
||||
call airline#themes#patch(g:airline#themes#dark#palette)
|
||||
call airline#highlighter#add_accent('red')
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
Assert NotEqual(0, hlID('airline_c_red'))
|
||||
End
|
||||
End
|
||||
109
dot_vim/plugged/vim-airline/test/init.vimspec
Normal file
109
dot_vim/plugged/vim-airline/test/init.vimspec
Normal file
@@ -0,0 +1,109 @@
|
||||
Describe init.vim
|
||||
function! s:clear()
|
||||
for key in s:sections
|
||||
unlet! g:airline_section_{key}
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning']
|
||||
call airline#init#bootstrap()
|
||||
|
||||
Before each
|
||||
call s:clear()
|
||||
call airline#init#sections()
|
||||
End
|
||||
|
||||
It section a should have mode, paste, spell, iminsert
|
||||
Assert Match(g:airline_section_a, 'mode')
|
||||
Assert Match(g:airline_section_a, 'paste')
|
||||
Assert Match(g:airline_section_a, 'spell')
|
||||
Assert Match(g:airline_section_a, 'iminsert')
|
||||
End
|
||||
|
||||
It section b should be blank because no extensions are installed
|
||||
Assert Equals(g:airline_section_b, '')
|
||||
End
|
||||
|
||||
It section c should be file and coc_status
|
||||
set noautochdir
|
||||
call airline#init#sections()
|
||||
Assert Equals(g:airline_section_c, '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#%#__accent_bold#%#__restore__#%#__accent_bold#%#__restore__#')
|
||||
End
|
||||
|
||||
It section c should be path and coc_status
|
||||
set autochdir
|
||||
call s:clear()
|
||||
call airline#init#sections()
|
||||
Assert Equals(g:airline_section_c, '%<%F%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#%#__accent_bold#%#__restore__#%#__accent_bold#%#__restore__#')
|
||||
End
|
||||
|
||||
It section x should be filetype
|
||||
Assert Equals(g:airline_section_x, '%#__accent_bold#%#__restore__#%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}')
|
||||
End
|
||||
|
||||
It section y should be fenc and ff
|
||||
Assert Equals(g:airline_section_y, '%{airline#util#wrap(airline#parts#ffenc(),0)}')
|
||||
End
|
||||
|
||||
It section z should be line numbers
|
||||
Assert Match(g:airline_section_z, '%p%%')
|
||||
Assert Match(g:airline_section_z, '%l')
|
||||
Assert Match(g:airline_section_z, '%v')
|
||||
End
|
||||
|
||||
It section gutter should be blank unless csv extension is installed
|
||||
" Note: the csv extension uses only the window local variable
|
||||
Assert Equals(g:airline_section_gutter, '%=')
|
||||
End
|
||||
|
||||
It section warning should be blank
|
||||
Assert Match(g:airline_section_warning, '')
|
||||
End
|
||||
|
||||
It should not redefine sections already defined
|
||||
for s in s:sections
|
||||
let g:airline_section_{s} = s
|
||||
endfor
|
||||
call airline#init#bootstrap()
|
||||
for s in s:sections
|
||||
Assert Equals(g:airline_section_{s}, s)
|
||||
endfor
|
||||
End
|
||||
|
||||
It all default statusline extensions should be blank
|
||||
Assert Equals(airline#parts#get('ale_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('ale_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('lsp_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('lsp_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('nvimlsp_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('nvimlsp_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('hunks').raw, '')
|
||||
Assert Equals(airline#parts#get('branch').raw, '')
|
||||
Assert Equals(airline#parts#get('eclim').raw, '')
|
||||
Assert Equals(airline#parts#get('neomake_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('neomake_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('obsession').raw, '')
|
||||
Assert Equals(airline#parts#get('syntastic-err').raw, '')
|
||||
Assert Equals(airline#parts#get('syntastic-warn').raw, '')
|
||||
Assert Equals(airline#parts#get('tagbar').raw , '')
|
||||
Assert Equals(airline#parts#get('whitespace').raw, '')
|
||||
Assert Equals(airline#parts#get('windowswap').raw , '')
|
||||
Assert Equals(airline#parts#get('ycm_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('ycm_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('languageclient_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('languageclient_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('coc_status').raw, '')
|
||||
Assert Equals(airline#parts#get('coc_current_function').raw, '')
|
||||
Assert Equals(airline#parts#get('vista').raw, '')
|
||||
Assert Equals(airline#parts#get('coc_warning_count').raw, '')
|
||||
Assert Equals(airline#parts#get('coc_error_count').raw, '')
|
||||
Assert Equals(airline#parts#get('battery').raw, '')
|
||||
End
|
||||
|
||||
it should not redefine parts already defined
|
||||
call airline#parts#define_raw('linenr', 'bar')
|
||||
call s:clear()
|
||||
call airline#init#sections()
|
||||
Assert Match(g:airline_section_z, 'bar')
|
||||
End
|
||||
End
|
||||
58
dot_vim/plugged/vim-airline/test/parts.vimspec
Normal file
58
dot_vim/plugged/vim-airline/test/parts.vimspec
Normal file
@@ -0,0 +1,58 @@
|
||||
Describe parts.vim
|
||||
|
||||
It overwrItes existing values
|
||||
call airline#parts#define('foo', { 'test': '123' })
|
||||
Assert Equals(airline#parts#get('foo').test, '123')
|
||||
call airline#parts#define('foo', { 'test': '321' })
|
||||
Assert Equals(airline#parts#get('foo').test, '321')
|
||||
End
|
||||
|
||||
It can define a function part
|
||||
call airline#parts#define_function('func', 'bar')
|
||||
Assert Equals(airline#parts#get('func').function, 'bar')
|
||||
End
|
||||
|
||||
It can define a text part
|
||||
call airline#parts#define_text('text', 'bar')
|
||||
Assert Equals(airline#parts#get('text').text, 'bar')
|
||||
End
|
||||
|
||||
It can define a raw part
|
||||
call airline#parts#define_raw('raw', 'bar')
|
||||
Assert Equals(airline#parts#get('raw').raw, 'bar')
|
||||
End
|
||||
|
||||
It can define a minwidth
|
||||
call airline#parts#define_minwidth('mw', 123)
|
||||
Assert Equals(airline#parts#get('mw').minwidth, 123)
|
||||
End
|
||||
|
||||
It can define a condition
|
||||
call airline#parts#define_condition('part', '1')
|
||||
Assert Equals(airline#parts#get('part').condition, '1')
|
||||
End
|
||||
|
||||
It can define a accent
|
||||
call airline#parts#define_accent('part', 'red')
|
||||
Assert Equals(airline#parts#get('part').accent, 'red')
|
||||
End
|
||||
|
||||
It value should be blank
|
||||
Assert Equals(airline#parts#filetype(), '')
|
||||
End
|
||||
|
||||
It can overwrIte a filetype
|
||||
set ft=aaa
|
||||
Assert Equals(airline#parts#filetype(), 'aaa')
|
||||
End
|
||||
|
||||
It can overwrite a filetype
|
||||
"GItHub actions's vim's column is smaller than 90
|
||||
set ft=aaaa
|
||||
if &columns >= 90
|
||||
Assert Equals(airline#parts#filetype(), 'aaaa')
|
||||
else
|
||||
Assert Equals(airline#parts#filetype(), 'aaa…')
|
||||
endif
|
||||
End
|
||||
End
|
||||
77
dot_vim/plugged/vim-airline/test/section.vimspec
Normal file
77
dot_vim/plugged/vim-airline/test/section.vimspec
Normal file
@@ -0,0 +1,77 @@
|
||||
Describe section
|
||||
Before
|
||||
call airline#parts#define_text('text', 'text')
|
||||
call airline#parts#define_raw('raw', 'raw')
|
||||
call airline#parts#define_function('func', 'SectionSpec')
|
||||
End
|
||||
|
||||
It should be able to reference default parts
|
||||
let s = airline#section#create(['paste'])
|
||||
Assert Equals(s, '%{airline#util#wrap(airline#parts#paste(),0)}')
|
||||
End
|
||||
|
||||
It should create sections wIth no separators
|
||||
let s = airline#section#create(['text', 'raw', 'func'])
|
||||
Assert Equals(s, '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}')
|
||||
End
|
||||
|
||||
It should create left sections with separators
|
||||
let s = airline#section#create_left(['text', 'text'])
|
||||
Assert Equals(s, '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}')
|
||||
End
|
||||
|
||||
It should create right sections wIth separators
|
||||
let s = airline#section#create_right(['text', 'text'])
|
||||
Assert Equals(s, '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}')
|
||||
End
|
||||
|
||||
It should prefix with accent group if provided and restore afterwards
|
||||
call airline#parts#define('hi', {
|
||||
\ 'raw': 'hello',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
let s = airline#section#create(['hi'])
|
||||
Assert Equals(s, '%#__accent_red#hello%#__restore__#')
|
||||
End
|
||||
|
||||
It should accent functions
|
||||
call airline#parts#define_function('hi', 'Hello')
|
||||
call airline#parts#define_accent('hi', 'bold')
|
||||
let s = airline#section#create(['hi'])
|
||||
Assert Equals(s, '%#__accent_bold#%{airline#util#wrap(Hello(),0)}%#__restore__#')
|
||||
End
|
||||
|
||||
It should parse out a section from the distro
|
||||
call airline#extensions#load()
|
||||
let s = airline#section#create(['whitespace'])
|
||||
Assert Match(s, 'airline#extensions#whitespace#check')
|
||||
End
|
||||
|
||||
It should use parts as is if they are not found
|
||||
let s = airline#section#create(['asdf', 'func'])
|
||||
Assert Equals(s, 'asdf%{airline#util#wrap(SectionSpec(),0)}')
|
||||
End
|
||||
|
||||
It should force add separators for raw and missing keys
|
||||
let s = airline#section#create_left(['asdf', 'raw'])
|
||||
Assert Equals(s, 'asdf raw')
|
||||
let s = airline#section#create_left(['asdf', 'aaaa', 'raw'])
|
||||
Assert Equals(s, 'asdf aaaa raw')
|
||||
let s = airline#section#create_right(['raw', '%f'])
|
||||
Assert Equals(s, 'raw %f')
|
||||
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
|
||||
Assert Equals(s, '%t asdf %{getcwd()}')
|
||||
End
|
||||
|
||||
It should empty out parts that do not pass their condition
|
||||
call airline#parts#define_text('conditional', 'conditional')
|
||||
call airline#parts#define_condition('conditional', '0')
|
||||
let s = airline#section#create(['conditional'])
|
||||
Assert Equals(s, '%{0 ? airline#util#wrap("conditional",0) : ""}')
|
||||
End
|
||||
|
||||
It should not draw two separators after another
|
||||
let s = airline#section#create_right(['ffenc','%{strftime("%H:%M")}'])
|
||||
Assert Equals(s, '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}')
|
||||
End
|
||||
End
|
||||
91
dot_vim/plugged/vim-airline/test/themes.vimspec
Normal file
91
dot_vim/plugged/vim-airline/test/themes.vimspec
Normal file
@@ -0,0 +1,91 @@
|
||||
Describe themes.vim
|
||||
After each
|
||||
highlight clear Foo
|
||||
highlight clear Normal
|
||||
End
|
||||
|
||||
It should extract correct colors
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Foo ctermfg=1 ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Assert Equals(colors[0], 'NONE')
|
||||
Assert Equals(colors[1], 'NONE')
|
||||
Assert Equals(colors[2], '1')
|
||||
Assert Equals(colors[3], '2')
|
||||
End
|
||||
|
||||
if exists("+termguicolors")
|
||||
It should extract correct colors with termguicolors
|
||||
call airline#highlighter#reset_hlcache()
|
||||
set termguicolors
|
||||
highlight Foo guifg=#cd0000 guibg=#00cd00 ctermfg=1 ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Assert Equals(colors[0], '#cd0000')
|
||||
Assert Equals(colors[1], '#00cd00')
|
||||
Assert Equals(colors[2], '1')
|
||||
Assert Equals(colors[3], '2')
|
||||
End
|
||||
endif
|
||||
|
||||
It should extract from normal if colors unavailable
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Normal ctermfg=100 ctermbg=200
|
||||
highlight Foo ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Assert Equals(colors[0], 'NONE')
|
||||
Assert Equals(colors[1], 'NONE')
|
||||
Assert Equals(colors[2], '100')
|
||||
Assert Equals(colors[3], '2')
|
||||
End
|
||||
|
||||
It should flip target group if It is reversed
|
||||
call airline#highlighter#reset_hlcache()
|
||||
highlight Foo ctermbg=222 ctermfg=103 cterm=reverse
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Assert Equals(colors[0], 'NONE')
|
||||
Assert Equals(colors[1], 'NONE')
|
||||
Assert Equals(colors[2], '222')
|
||||
Assert Equals(colors[3], '103')
|
||||
End
|
||||
|
||||
It should pass args through correctly
|
||||
call airline#highlighter#reset_hlcache()
|
||||
hi clear Normal
|
||||
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
|
||||
Assert Equals(hl, ['NONE', 'NONE', 'NONE', 'NONE', 'bold,italic'])
|
||||
|
||||
let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold')
|
||||
Assert Equals(hl, ['NONE', 'NONE', 'NONE', 'NONE', 'italic,bold'])
|
||||
End
|
||||
|
||||
It should generate color map with mirroring
|
||||
let map = airline#themes#generate_color_map(
|
||||
\ [ 1, 1, 1, 1, '1' ],
|
||||
\ [ 2, 2, 2, 2, '2' ],
|
||||
\ [ 3, 3, 3, 3, '3' ],
|
||||
\ )
|
||||
Assert Equals(map.airline_a[0], 1)
|
||||
Assert Equals(map.airline_b[0], 2)
|
||||
Assert Equals(map.airline_c[0], 3)
|
||||
Assert Equals(map.airline_x[0], 3)
|
||||
Assert Equals(map.airline_y[0], 2)
|
||||
Assert Equals(map.airline_z[0], 1)
|
||||
End
|
||||
|
||||
It should generate color map with full set of colors
|
||||
let map = airline#themes#generate_color_map(
|
||||
\ [ 1, 1, 1, 1, '1' ],
|
||||
\ [ 2, 2, 2, 2, '2' ],
|
||||
\ [ 3, 3, 3, 3, '3' ],
|
||||
\ [ 4, 4, 4, 4, '4' ],
|
||||
\ [ 5, 5, 5, 5, '5' ],
|
||||
\ [ 6, 6, 6, 6, '6' ],
|
||||
\ )
|
||||
Assert Equals(map.airline_a[0], 1)
|
||||
Assert Equals(map.airline_b[0], 2)
|
||||
Assert Equals(map.airline_c[0], 3)
|
||||
Assert Equals(map.airline_x[0], 4)
|
||||
Assert Equals(map.airline_y[0], 5)
|
||||
Assert Equals(map.airline_z[0], 6)
|
||||
End
|
||||
End
|
||||
69
dot_vim/plugged/vim-airline/test/util.vimspec
Normal file
69
dot_vim/plugged/vim-airline/test/util.vimspec
Normal file
@@ -0,0 +1,69 @@
|
||||
call airline#init#bootstrap()
|
||||
|
||||
function! Util1()
|
||||
let g:count += 1
|
||||
endfunction
|
||||
|
||||
function! Util2()
|
||||
let g:count += 2
|
||||
endfunction
|
||||
|
||||
function! Util3(...)
|
||||
let g:count = a:0
|
||||
endfunction
|
||||
|
||||
Describe util
|
||||
Before each
|
||||
let g:count = 0
|
||||
End
|
||||
|
||||
It has append wrapper function
|
||||
Assert Equals(airline#util#append('', 0), '')
|
||||
Assert Equals(airline#util#append('1', 0), ' 1')
|
||||
End
|
||||
|
||||
It should be same &columns
|
||||
let g:airline_statusline_ontop = 1
|
||||
Assert Equals(airline#util#winwidth(), &columns)
|
||||
End
|
||||
|
||||
It should be same winwidth(0)
|
||||
let g:airline_statusline_ontop = 0
|
||||
Assert Equals(airline#util#winwidth(), winwidth(0))
|
||||
End
|
||||
|
||||
It should be same winwidth(30)
|
||||
Assert Equals(airline#util#winwidth(30, 0), winwidth(30))
|
||||
End
|
||||
|
||||
It has prepend wrapper function
|
||||
Assert Equals(airline#util#prepend('', 0), '')
|
||||
Assert Equals(airline#util#prepend('1', 0), '1 ')
|
||||
End
|
||||
|
||||
It has getwinvar function
|
||||
Assert Equals(airline#util#getwinvar(1, 'asdf', '123'), '123')
|
||||
call setwinvar(1, 'vspec', 'is cool')
|
||||
Assert Equals(airline#util#getwinvar(1, 'vspec', ''), 'is cool')
|
||||
End
|
||||
|
||||
It has exec funcrefs helper functions
|
||||
call airline#util#exec_funcrefs([function('Util1'), function('Util2')])
|
||||
Assert Equals(g:count, 3)
|
||||
|
||||
call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4)
|
||||
Assert Equals(g:count, 4)
|
||||
End
|
||||
|
||||
It should ignore minwidth if less than 0
|
||||
Assert Equals(airline#util#append('foo', -1), ' foo')
|
||||
Assert Equals(airline#util#prepend('foo', -1), 'foo ')
|
||||
Assert Equals(airline#util#wrap('foo', -1), 'foo')
|
||||
End
|
||||
|
||||
It should return empty if winwidth() > minwidth
|
||||
Assert Equals(airline#util#append('foo', 99999), '')
|
||||
Assert Equals(airline#util#prepend('foo', 99999), '')
|
||||
Assert Equals(airline#util#wrap('foo', 99999), '')
|
||||
End
|
||||
End
|
||||
Reference in New Issue
Block a user