2013-08-31 09:15:41 +08:00
|
|
|
call airline#init#bootstrap()
|
2013-09-02 03:19:34 +08:00
|
|
|
call airline#extensions#load()
|
2013-08-31 09:15:41 +08:00
|
|
|
|
|
|
|
function! SectionSpec()
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
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 create sections with no separators'
|
|
|
|
let s = airline#section#create(['text', 'raw', 'func'])
|
2013-09-01 00:33:58 +08:00
|
|
|
Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}'
|
2013-08-31 09:15:41 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should create left sections with separators'
|
|
|
|
let s = airline#section#create_left(['text', 'text'])
|
2013-09-01 00:33:58 +08:00
|
|
|
Expect s == '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}'
|
2013-08-31 09:15:41 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should create right sections with separators'
|
|
|
|
let s = airline#section#create_right(['text', 'text'])
|
2013-09-01 00:33:58 +08:00
|
|
|
Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}'
|
2013-08-31 09:15:41 +08:00
|
|
|
end
|
2013-08-31 11:26:59 +08:00
|
|
|
|
|
|
|
it 'should prefix with highlight group if provided'
|
2013-09-01 10:48:27 +08:00
|
|
|
call airline#parts#define('hi', {
|
|
|
|
\ 'raw': 'hello',
|
|
|
|
\ 'highlight': 'hlgroup',
|
|
|
|
\ })
|
2013-08-31 11:26:59 +08:00
|
|
|
let s = airline#section#create(['hi'])
|
|
|
|
Expect s == '%#hlgroup#hello'
|
|
|
|
end
|
2013-09-01 05:42:09 +08:00
|
|
|
|
2013-09-02 00:07:46 +08:00
|
|
|
it 'should parse out a section from the distro'
|
2013-09-01 05:42:09 +08:00
|
|
|
let s = airline#section#create(['whitespace'])
|
|
|
|
Expect s =~ 'airline#extensions#whitespace#check'
|
|
|
|
end
|
2013-09-01 10:48:27 +08:00
|
|
|
|
|
|
|
it 'should use parts as is if they are not found'
|
|
|
|
let s = airline#section#create(['asdf', 'func'])
|
|
|
|
Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}'
|
|
|
|
end
|
2013-09-02 00:07:46 +08:00
|
|
|
|
|
|
|
it 'should force add separators for raw and missing keys'
|
|
|
|
let s = airline#section#create_left(['asdf', 'raw'])
|
|
|
|
Expect s == 'asdf > raw'
|
|
|
|
let s = airline#section#create_left(['asdf', 'aaaa', 'raw'])
|
|
|
|
Expect s == 'asdf > aaaa > raw'
|
|
|
|
let s = airline#section#create_right(['raw', '%f'])
|
|
|
|
Expect s == 'raw < %f'
|
|
|
|
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
|
|
|
|
Expect s == '%t < asdf < %{getcwd()}'
|
|
|
|
end
|
2013-08-31 09:15:41 +08:00
|
|
|
end
|
|
|
|
|