2013-08-30 21:28:38 -04: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-30 20:26:42 -04:00
|
|
|
|
2013-09-25 14:48:18 -04:00
|
|
|
call airline#init#bootstrap()
|
|
|
|
|
|
|
|
describe 'init sections'
|
2013-08-30 21:28:38 -04:00
|
|
|
before
|
|
|
|
call s:clear()
|
2013-08-31 17:42:09 -04:00
|
|
|
call airline#init#sections()
|
2013-08-30 21:28:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
after
|
|
|
|
call s:clear()
|
|
|
|
end
|
|
|
|
|
2013-08-30 20:26:42 -04:00
|
|
|
it 'section a should have mode, paste, iminsert'
|
|
|
|
Expect g:airline_section_a =~ 'mode'
|
|
|
|
Expect g:airline_section_a =~ 'paste'
|
|
|
|
Expect g:airline_section_a =~ 'iminsert'
|
|
|
|
end
|
|
|
|
|
2013-08-30 23:35:23 -04:00
|
|
|
it 'section b should be blank because no extensions are installed'
|
|
|
|
Expect g:airline_section_b == ''
|
2013-08-30 20:26:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'section c should be file'
|
2013-09-30 10:37:02 -04:00
|
|
|
Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#'
|
2013-08-30 20:26:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'section x should be filetype'
|
2013-09-01 13:59:22 -04:00
|
|
|
Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}'
|
2013-08-30 20:26:42 -04: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'
|
|
|
|
Expect g:airline_section_z =~ '%3p%%'
|
2013-09-22 18:05:58 -04:00
|
|
|
Expect g:airline_section_z =~ '%4l'
|
2015-01-18 11:04:26 -05:00
|
|
|
Expect g:airline_section_z =~ '%3v'
|
2013-08-30 20:26:42 -04:00
|
|
|
end
|
2013-08-30 21:28:38 -04: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-30 23:35:23 -04:00
|
|
|
|
|
|
|
it 'all default statusline extensions should be blank'
|
|
|
|
Expect airline#parts#get('hunks').raw == ''
|
|
|
|
Expect airline#parts#get('branch').raw == ''
|
|
|
|
Expect airline#parts#get('tagbar').raw == ''
|
|
|
|
Expect airline#parts#get('syntastic').raw == ''
|
2013-10-01 00:42:42 -04:00
|
|
|
Expect airline#parts#get('eclim').raw == ''
|
2013-09-05 10:01:57 -04:00
|
|
|
Expect airline#parts#get('whitespace').raw == ''
|
2013-08-30 23:35:23 -04:00
|
|
|
end
|
2013-08-30 20:26:42 -04:00
|
|
|
end
|
|
|
|
|
2013-09-25 14:48:18 -04: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
|
|
|
|
|