2013-08-31 09:28:38 +08:00
|
|
|
let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning']
|
|
|
|
|
|
|
|
function! s:clear()
|
|
|
|
for key in s:sections
|
|
|
|
unlet! g:airline_section_{key}
|
|
|
|
endfor
|
|
|
|
endfunction
|
2013-08-31 08:26:42 +08:00
|
|
|
|
2013-09-26 02:48:18 +08:00
|
|
|
call airline#init#bootstrap()
|
|
|
|
|
|
|
|
describe 'init sections'
|
2013-08-31 09:28:38 +08:00
|
|
|
before
|
|
|
|
call s:clear()
|
2013-09-01 05:42:09 +08:00
|
|
|
call airline#init#sections()
|
2013-08-31 09:28:38 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
after
|
|
|
|
call s:clear()
|
|
|
|
end
|
|
|
|
|
2016-03-22 14:52:04 +08:00
|
|
|
it 'section a should have mode, paste, spell, iminsert'
|
2013-08-31 08:26:42 +08:00
|
|
|
Expect g:airline_section_a =~ 'mode'
|
|
|
|
Expect g:airline_section_a =~ 'paste'
|
2016-03-22 14:52:04 +08:00
|
|
|
Expect g:airline_section_a =~ 'spell'
|
2013-08-31 08:26:42 +08:00
|
|
|
Expect g:airline_section_a =~ 'iminsert'
|
|
|
|
end
|
|
|
|
|
2013-08-31 11:35:23 +08:00
|
|
|
it 'section b should be blank because no extensions are installed'
|
|
|
|
Expect g:airline_section_b == ''
|
2013-08-31 08:26:42 +08:00
|
|
|
end
|
|
|
|
|
2020-02-28 07:06:00 +08:00
|
|
|
it 'section c should be file and coc_status'
|
2021-01-02 16:42:09 +08:00
|
|
|
Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#%#__accent_bold#%#__restore__#%#__accent_bold#%#__restore__#'
|
2013-08-31 08:26:42 +08:00
|
|
|
end
|
|
|
|
|
2021-04-27 01:56:54 +08:00
|
|
|
it 'section c should be path and coc_status'
|
|
|
|
set autochdir
|
|
|
|
call s:clear()
|
|
|
|
call airline#init#sections()
|
|
|
|
Expect g:airline_section_c == '%<%F%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#%#__accent_bold#%#__restore__#%#__accent_bold#%#__restore__#'
|
|
|
|
end
|
|
|
|
|
2013-08-31 08:26:42 +08:00
|
|
|
it 'section x should be filetype'
|
2021-03-20 07:42:46 +08:00
|
|
|
Expect 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)}'
|
2013-08-31 08:26:42 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'section y should be fenc and ff'
|
|
|
|
Expect g:airline_section_y =~ 'ff'
|
|
|
|
Expect g:airline_section_y =~ 'fenc'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'section z should be line numbers'
|
2020-07-09 05:23:38 +08:00
|
|
|
Expect g:airline_section_z =~ '%p%%'
|
|
|
|
Expect g:airline_section_z =~ '%l'
|
|
|
|
Expect g:airline_section_z =~ '%v'
|
2013-08-31 08:26:42 +08:00
|
|
|
end
|
2013-08-31 09:28:38 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
Expect g:airline_section_{s} == s
|
|
|
|
endfor
|
|
|
|
end
|
2013-08-31 11:35:23 +08:00
|
|
|
|
|
|
|
it 'all default statusline extensions should be blank'
|
2017-06-21 04:38:56 +08:00
|
|
|
Expect airline#parts#get('ale_error_count').raw == ''
|
|
|
|
Expect airline#parts#get('ale_warning_count').raw == ''
|
2020-02-08 16:40:45 +08:00
|
|
|
Expect airline#parts#get('lsp_error_count').raw == ''
|
|
|
|
Expect airline#parts#get('lsp_warning_count').raw == ''
|
2020-07-20 05:04:45 +08:00
|
|
|
Expect airline#parts#get('nvimlsp_error_count').raw == ''
|
|
|
|
Expect airline#parts#get('nvimlsp_warning_count').raw == ''
|
2013-08-31 11:35:23 +08:00
|
|
|
Expect airline#parts#get('hunks').raw == ''
|
|
|
|
Expect airline#parts#get('branch').raw == ''
|
2013-10-01 12:42:42 +08:00
|
|
|
Expect airline#parts#get('eclim').raw == ''
|
2017-06-21 04:38:56 +08:00
|
|
|
Expect airline#parts#get('neomake_error_count').raw == ''
|
|
|
|
Expect airline#parts#get('neomake_warning_count').raw == ''
|
|
|
|
Expect airline#parts#get('obsession').raw == ''
|
|
|
|
Expect airline#parts#get('syntastic-err').raw == ''
|
|
|
|
Expect airline#parts#get('syntastic-warn').raw == ''
|
|
|
|
Expect airline#parts#get('tagbar').raw == ''
|
2013-09-05 22:01:57 +08:00
|
|
|
Expect airline#parts#get('whitespace').raw == ''
|
2017-06-21 04:38:56 +08:00
|
|
|
Expect airline#parts#get('windowswap').raw == ''
|
|
|
|
Expect airline#parts#get('ycm_error_count').raw == ''
|
|
|
|
Expect airline#parts#get('ycm_warning_count').raw == ''
|
2018-09-03 05:08:04 +08:00
|
|
|
Expect airline#parts#get('languageclient_error_count').raw == ''
|
|
|
|
Expect airline#parts#get('languageclient_warning_count').raw == ''
|
2020-02-28 07:06:00 +08:00
|
|
|
Expect airline#parts#get('coc_status').raw == ''
|
2021-03-20 07:42:46 +08:00
|
|
|
Expect airline#parts#get('coc_current_function').raw == ''
|
2020-04-03 00:00:55 +08:00
|
|
|
Expect airline#parts#get('vista').raw == ''
|
2020-04-03 11:15:42 +08:00
|
|
|
Expect airline#parts#get('coc_warning_count').raw == ''
|
|
|
|
Expect airline#parts#get('coc_error_count').raw == ''
|
2020-09-29 20:55:03 +08:00
|
|
|
Expect airline#parts#get('battery').raw == ''
|
2013-08-31 11:35:23 +08:00
|
|
|
end
|
2013-08-31 08:26:42 +08:00
|
|
|
end
|
|
|
|
|
2013-09-26 02:48:18 +08:00
|
|
|
describe 'init parts'
|
|
|
|
it 'should not redefine parts already defined'
|
|
|
|
call airline#parts#define_raw('linenr', 'bar')
|
|
|
|
call airline#init#sections()
|
|
|
|
Expect g:airline_section_z =~ 'bar'
|
|
|
|
end
|
|
|
|
end
|