From 56560fd597f94dfe6fe5fa79648398ab29d05775 Mon Sep 17 00:00:00 2001 From: xero Date: Mon, 14 Jul 2014 13:23:05 -0400 Subject: updated repo to manage dotfiles via gnu stow, the symlink farm manager. happy birthday commit! :birthday: :sparkles: --- vim/.vim/bundle/vim-airline/t/airline.vim | 87 ++++++++++++++++++++++ vim/.vim/bundle/vim-airline/t/builder.vim | 80 ++++++++++++++++++++ vim/.vim/bundle/vim-airline/t/commands.vim | 33 ++++++++ .../bundle/vim-airline/t/extensions_default.vim | 32 ++++++++ vim/.vim/bundle/vim-airline/t/highlighter.vim | 21 ++++++ vim/.vim/bundle/vim-airline/t/init.vim | 77 +++++++++++++++++++ vim/.vim/bundle/vim-airline/t/parts.vim | 39 ++++++++++ vim/.vim/bundle/vim-airline/t/section.vim | 76 +++++++++++++++++++ vim/.vim/bundle/vim-airline/t/themes.vim | 68 +++++++++++++++++ vim/.vim/bundle/vim-airline/t/util.vim | 54 ++++++++++++++ 10 files changed, 567 insertions(+) create mode 100644 vim/.vim/bundle/vim-airline/t/airline.vim create mode 100644 vim/.vim/bundle/vim-airline/t/builder.vim create mode 100644 vim/.vim/bundle/vim-airline/t/commands.vim create mode 100644 vim/.vim/bundle/vim-airline/t/extensions_default.vim create mode 100644 vim/.vim/bundle/vim-airline/t/highlighter.vim create mode 100644 vim/.vim/bundle/vim-airline/t/init.vim create mode 100644 vim/.vim/bundle/vim-airline/t/parts.vim create mode 100644 vim/.vim/bundle/vim-airline/t/section.vim create mode 100644 vim/.vim/bundle/vim-airline/t/themes.vim create mode 100644 vim/.vim/bundle/vim-airline/t/util.vim (limited to 'vim/.vim/bundle/vim-airline/t') diff --git a/vim/.vim/bundle/vim-airline/t/airline.vim b/vim/.vim/bundle/vim-airline/t/airline.vim new file mode 100644 index 0000000..78ab6d7 --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/airline.vim @@ -0,0 +1,87 @@ +let g:airline_theme = 'dark' +call airline#init#bootstrap() +call airline#init#sections() +source plugin/airline.vim + +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 + +describe 'airline' + 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() + Expect 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() + Expect &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() + Expect 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() + Expect 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') + Expect len(g:airline_statusline_funcrefs) == c + end + + it 'should overwrite the statusline with active and inactive splits' + wincmd s + Expect airline#statusline(1) !~ 'inactive' + Expect 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 + Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode' + wincmd c + end + + it 'should not collapse the inactive split if the variable is set false' + let g:airline_inactive_collapse = 0 + wincmd s + Expect getwinvar(2, '&statusline') != 'airline#parts#mode' + wincmd c + end + + it 'should include check_mode' + Expect airline#statusline(1) =~ 'airline#check_mode' + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/builder.vim b/vim/.vim/bundle/vim-airline/t/builder.vim new file mode 100644 index 0000000..3d1afcd --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/builder.vim @@ -0,0 +1,80 @@ +let g:airline_theme = 'dark' +call airline#init#bootstrap() + +describe 'active builder' + before + let s:builder = airline#builder#new({'active': 1}) + end + + it 'should start with an empty statusline' + let stl = s:builder.build() + Expect stl == '' + end + + it 'should transition colors from one to the next' + call s:builder.add_section('Normal', 'hello') + call s:builder.add_section('NonText', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal#hello%#Normal_to_NonText#>%#NonText#world' + end + + it 'should split left/right sections' + call s:builder.split() + let stl = s:builder.build() + Expect 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('NonText', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal#hello%#Normal_to_NonText#<%#NonText#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() + Expect stl == '%#Normal#hello>hello' + end + + it 'should replace accent groups with the specified group' + call s:builder.add_section('Normal', '%#__accent_foo#hello') + let stl = s:builder.build() + Expect 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() + Expect 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() + Expect stl !~ '%#__restore__#' + Expect stl =~ '%#Normal#' + end +end + +describe 'inactive builder' + before + 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('NonText', 'world') + let stl = s:builder.build() + Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_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() + Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld' + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/commands.vim b/vim/.vim/bundle/vim-airline/t/commands.vim new file mode 100644 index 0000000..b56b881 --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/commands.vim @@ -0,0 +1,33 @@ +call airline#init#bootstrap() +call airline#init#sections() + +source plugin/airline.vim + +describe 'commands' + it 'should toggle off and on' + execute 'AirlineToggle' + Expect exists('#airline') to_be_false + execute 'AirlineToggle' + Expect exists('#airline') to_be_true + end + + it 'should toggle whitespace off and on' + call airline#extensions#load() + execute 'AirlineToggleWhitespace' + Expect exists('#airline_whitespace') to_be_false + execute 'AirlineToggleWhitespace' + Expect exists('#airline_whitespace') to_be_true + end + + it 'should display theme name with no args' + execute 'AirlineTheme simple' + Expect g:airline_theme == 'simple' + execute 'AirlineTheme dark' + Expect g:airline_theme == 'dark' + end + + it 'should have a refresh command' + Expect exists(':AirlineRefresh') to_be_true + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/extensions_default.vim b/vim/.vim/bundle/vim-airline/t/extensions_default.vim new file mode 100644 index 0000000..b98e816 --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/extensions_default.vim @@ -0,0 +1,32 @@ +let g:airline_theme = 'dark' +call airline#init#bootstrap() +call airline#init#sections() +source plugin/airline.vim + +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 + + it 'should only render warning section in active splits' + wincmd s + Expect airline#statusline(1) =~ 'warning' + Expect airline#statusline(2) !~ 'warning' + wincmd c + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/highlighter.vim b/vim/.vim/bundle/vim-airline/t/highlighter.vim new file mode 100644 index 0000000..a1ed490 --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/highlighter.vim @@ -0,0 +1,21 @@ +let g:airline_theme = 'dark' + +describe 'highlighter' + it 'should create separator highlight groups' + hi Foo1 ctermfg=1 ctermbg=2 + hi Foo2 ctermfg=3 ctermbg=4 + call airline#highlighter#add_separator('Foo1', 'Foo2', 0) + let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') + Expect hl == [ '', '', '4', '2', '' ] + end + + it 'should populate accent colors' + Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false + Expect hlID('airline_c_red') == 0 + call airline#themes#patch(g:airline#themes#dark#palette) + call airline#highlighter#add_accent('red') + call airline#highlighter#highlight(['normal']) + Expect hlID('airline_c_red') != 0 + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/init.vim b/vim/.vim/bundle/vim-airline/t/init.vim new file mode 100644 index 0000000..86efe58 --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/init.vim @@ -0,0 +1,77 @@ +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 + +call airline#init#bootstrap() + +describe 'init sections' + before + call s:clear() + call airline#init#sections() + end + + after + call s:clear() + end + + 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 + + it 'section b should be blank because no extensions are installed' + Expect g:airline_section_b == '' + end + + it 'section c should be file' + Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' + end + + it 'section x should be filetype' + Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}' + 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%%' + Expect g:airline_section_z =~ '%4l' + Expect g:airline_section_z =~ '%3c' + 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 + Expect g:airline_section_{s} == s + endfor + end + + 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 == '' + Expect airline#parts#get('eclim').raw == '' + Expect airline#parts#get('whitespace').raw == '' + end +end + +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 + diff --git a/vim/.vim/bundle/vim-airline/t/parts.vim b/vim/.vim/bundle/vim-airline/t/parts.vim new file mode 100644 index 0000000..ee7c92e --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/parts.vim @@ -0,0 +1,39 @@ +describe 'parts' + it 'overwrites existing values' + call airline#parts#define('foo', { 'test': '123' }) + Expect airline#parts#get('foo').test == '123' + call airline#parts#define('foo', { 'test': '321' }) + Expect airline#parts#get('foo').test == '321' + end + + it 'can define a function part' + call airline#parts#define_function('func', 'bar') + Expect airline#parts#get('func').function == 'bar' + end + + it 'can define a text part' + call airline#parts#define_text('text', 'bar') + Expect airline#parts#get('text').text == 'bar' + end + + it 'can define a raw part' + call airline#parts#define_raw('raw', 'bar') + Expect airline#parts#get('raw').raw == 'bar' + end + + it 'can define a minwidth' + call airline#parts#define_minwidth('mw', 123) + Expect airline#parts#get('mw').minwidth == 123 + end + + it 'can define a condition' + call airline#parts#define_condition('part', '1') + Expect airline#parts#get('part').condition == '1' + end + + it 'can define a accent' + call airline#parts#define_accent('part', 'red') + Expect airline#parts#get('part').accent == 'red' + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/section.vim b/vim/.vim/bundle/vim-airline/t/section.vim new file mode 100644 index 0000000..034440c --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/section.vim @@ -0,0 +1,76 @@ +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 be able to reference default parts' + let s = airline#section#create(['paste']) + Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}' + end + + it 'should create sections with no separators' + let s = airline#section#create(['text', 'raw', 'func']) + Expect 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']) + Expect 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']) + Expect 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']) + Expect 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']) + Expect 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']) + Expect s =~ 'airline#extensions#whitespace#check' + end + + 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 + + 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 + + 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']) + Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}' + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/themes.vim b/vim/.vim/bundle/vim-airline/t/themes.vim new file mode 100644 index 0000000..d735229 --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/themes.vim @@ -0,0 +1,68 @@ +describe 'themes' + after + highlight clear Foo + highlight clear Normal + end + + it 'should extract correct colors' + highlight Foo ctermfg=1 ctermbg=2 + let colors = airline#themes#get_highlight('Foo') + Expect colors[2] == '1' + Expect colors[3] == '2' + end + + it 'should extract from normal if colors unavailable' + highlight Normal ctermfg=100 ctermbg=200 + highlight Foo ctermbg=2 + let colors = airline#themes#get_highlight('Foo') + Expect colors[2] == '100' + Expect colors[3] == '2' + end + + it 'should flip target group if it is reversed' + highlight Foo ctermbg=222 ctermfg=103 term=reverse + let colors = airline#themes#get_highlight('Foo') + Expect colors[2] == '222' + Expect colors[3] == '103' + end + + it 'should pass args through correctly' + let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') + Expect hl == ['', '', 0, 1, 'bold,italic'] + + let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold') + Expect hl == ['', '', 1, 0, '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' ], + \ ) + Expect map.airline_a[0] == 1 + Expect map.airline_b[0] == 2 + Expect map.airline_c[0] == 3 + Expect map.airline_x[0] == 3 + Expect map.airline_y[0] == 2 + Expect 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' ], + \ ) + Expect map.airline_a[0] == 1 + Expect map.airline_b[0] == 2 + Expect map.airline_c[0] == 3 + Expect map.airline_x[0] == 4 + Expect map.airline_y[0] == 5 + Expect map.airline_z[0] == 6 + end +end + diff --git a/vim/.vim/bundle/vim-airline/t/util.vim b/vim/.vim/bundle/vim-airline/t/util.vim new file mode 100644 index 0000000..913de9d --- /dev/null +++ b/vim/.vim/bundle/vim-airline/t/util.vim @@ -0,0 +1,54 @@ +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 + let g:count = 0 + end + + it 'has append wrapper function' + Expect airline#util#append('', 0) == '' + Expect airline#util#append('1', 0) == ' > 1' + end + + it 'has prepend wrapper function' + Expect airline#util#prepend('', 0) == '' + Expect airline#util#prepend('1', 0) == '1 < ' + end + + it 'has getwinvar function' + Expect airline#util#getwinvar(1, 'asdf', '123') == '123' + call setwinvar(1, 'vspec', 'is cool') + Expect airline#util#getwinvar(1, 'vspec', '') == 'is cool' + end + + it 'has exec funcrefs helper functions' + call airline#util#exec_funcrefs([function('Util1'), function('Util2')]) + Expect g:count == 3 + + call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4) + Expect g:count == 4 + end + + it 'should ignore minwidth if less than 0' + Expect airline#util#append('foo', -1) == ' > foo' + Expect airline#util#prepend('foo', -1) == 'foo < ' + Expect airline#util#wrap('foo', -1) == 'foo' + end + + it 'should return empty if winwidth() > minwidth' + Expect airline#util#append('foo', 99999) == '' + Expect airline#util#prepend('foo', 99999) == '' + Expect airline#util#wrap('foo', 99999) == '' + end +end + -- cgit v1.2.1