test the layout config for the default extension.

This commit is contained in:
Bailey Ling 2013-08-30 22:44:20 -04:00
parent e852fb388f
commit d268744077
3 changed files with 26 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
doc/tags doc/tags
*.lock *.lock
.vim-flavor

View File

@ -27,7 +27,9 @@ function! airline#extensions#branch#get_head()
endif endif
endif endif
return empty(head) ? s:empty_message : s:symbol.' '.head return empty(head)
\ ? s:empty_message
\ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.' ', head)
endfunction endfunction
function! airline#extensions#branch#init(ext) function! airline#extensions#branch#init(ext)

22
t/extensions_default.vim Normal file
View File

@ -0,0 +1,22 @@
call airline#init#bootstrap()
describe 'default'
before
let s:builder = airline#builder#new({'active': 1})
end
it 'should use the layout'
let g:airline#extensions#default#layout = [
\ [ 'c', 'a', 'b', 'warning' ],
\ [ 'x', 'z', 'y' ]
\ ]
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
let stl = s:builder.build()
Expect stl =~ 'airline_c_to_airline_a'
Expect stl =~ 'airline_a_to_airline_b'
Expect stl =~ 'airline_b_to_airline_warning'
Expect stl =~ 'airline_x_to_airline_z'
Expect stl =~ 'airline_z_to_airline_y'
end
end