aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/share/nvim/site/t
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.local/share/nvim/site/t')
-rw-r--r--dotfiles/.local/share/nvim/site/t/airline.vim86
-rw-r--r--dotfiles/.local/share/nvim/site/t/builder.vim107
-rw-r--r--dotfiles/.local/share/nvim/site/t/commands.vim34
-rw-r--r--dotfiles/.local/share/nvim/site/t/extensions_default.vim30
-rw-r--r--dotfiles/.local/share/nvim/site/t/extensions_tabline.vim21
-rw-r--r--dotfiles/.local/share/nvim/site/t/highlighter.vim20
-rw-r--r--dotfiles/.local/share/nvim/site/t/init.vim88
-rw-r--r--dotfiles/.local/share/nvim/site/t/parts.vim38
-rw-r--r--dotfiles/.local/share/nvim/site/t/section.vim80
-rw-r--r--dotfiles/.local/share/nvim/site/t/themes.vim72
-rw-r--r--dotfiles/.local/share/nvim/site/t/util.vim53
11 files changed, 629 insertions, 0 deletions
diff --git a/dotfiles/.local/share/nvim/site/t/airline.vim b/dotfiles/.local/share/nvim/site/t/airline.vim
new file mode 100644
index 0000000..1569cc4
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/airline.vim
@@ -0,0 +1,86 @@
+let g:airline_theme = 'dark'
+
+source plugin/airline.vim
+doautocmd VimEnter
+
+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/dotfiles/.local/share/nvim/site/t/builder.vim b/dotfiles/.local/share/nvim/site/t/builder.vim
new file mode 100644
index 0000000..8128312
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/builder.vim
@@ -0,0 +1,107 @@
+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('Search', 'world')
+ let stl = s:builder.build()
+ Expect stl =~ '%#Normal#hello%#Normal_to_Search#%#Search#world'
+ end
+
+ it 'should reuse highlight group if background colors match'
+ call airline#highlighter#reset_hlcache()
+ highlight Foo1 ctermfg=1 ctermbg=2
+ highlight Foo2 ctermfg=1 ctermbg=2
+ call s:builder.add_section('Foo1', 'hello')
+ call s:builder.add_section('Foo2', 'world')
+ let stl = s:builder.build()
+ Expect stl =~ '%#Foo1#helloworld'
+ end
+
+ it 'should switch highlight groups if foreground colors differ'
+ call airline#highlighter#reset_hlcache()
+ highlight Foo1 ctermfg=1 ctermbg=2
+ highlight Foo2 ctermfg=2 ctermbg=2
+ call s:builder.add_section('Foo1', 'hello')
+ call s:builder.add_section('Foo2', 'world')
+ let stl = s:builder.build()
+ Expect stl =~ '%#Foo1#hello%#Foo1_to_Foo2#%#Foo2#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('Search', 'world')
+ let stl = s:builder.build()
+ Expect stl =~ 'hello%#Normal_to_Search#%#Search#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#hellohello'
+ 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
+
+ it 'should blend colors from the left through the split to the right'
+ call s:builder.add_section('Normal', 'hello')
+ call s:builder.split()
+ call s:builder.add_section('Search', 'world')
+ let stl = s:builder.build()
+ Expect stl =~ 'Normal_to_Search'
+ 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('Search', 'world')
+ let stl = s:builder.build()
+ Expect stl =~ '%#Normal_inactive#hello%#Normal_to_Search_inactive#%#Search_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/dotfiles/.local/share/nvim/site/t/commands.vim b/dotfiles/.local/share/nvim/site/t/commands.vim
new file mode 100644
index 0000000..13338af
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/commands.vim
@@ -0,0 +1,34 @@
+source plugin/airline.vim
+doautocmd VimEnter
+
+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'
+ execute 'AirlineTheme doesnotexist'
+ Expect g:airline_theme == 'dark'
+ colors molokai
+ Expect g:airline_theme == 'molokai'
+ end
+
+ it 'should have a refresh command'
+ Expect exists(':AirlineRefresh') to_be_true
+ end
+end
diff --git a/dotfiles/.local/share/nvim/site/t/extensions_default.vim b/dotfiles/.local/share/nvim/site/t/extensions_default.vim
new file mode 100644
index 0000000..00d4b04
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/extensions_default.vim
@@ -0,0 +1,30 @@
+let g:airline#extensions#default#layout = [
+ \ [ 'c', 'a', 'b', 'warning' ],
+ \ [ 'x', 'z', 'y' ]
+ \ ]
+
+source plugin/airline.vim
+doautocmd VimEnter
+
+describe 'default'
+ before
+ let s:builder = airline#builder#new({'active': 1})
+ end
+
+ it 'should use the layout'
+ 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/dotfiles/.local/share/nvim/site/t/extensions_tabline.vim b/dotfiles/.local/share/nvim/site/t/extensions_tabline.vim
new file mode 100644
index 0000000..9349b81
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/extensions_tabline.vim
@@ -0,0 +1,21 @@
+let g:airline#extensions#tabline#enabled = 1
+
+source plugin/airline.vim
+doautocmd VimEnter
+
+describe 'default'
+
+ it 'should use a tabline'
+ e! CHANGELOG.md
+ sp CONTRIBUTING.md
+ Expect airline#extensions#tabline#get() == "%#airline_tabhid#...| %(%{airline#extensions#tabline#get_buffer_name(3)}%) %#airline_tabhid_to_airline_tab# %#airline_tab#%(%{airline#extensions#tabline#get_buffer_name(4)}%) %#airline_tab_to_airline_tabsel# %#airline_tabsel#%(%{airline#extensions#tabline#get_buffer_name(5)}%) %#airline_tabsel_to_airline_tabfill# %#airline_tabfill#%=%#airline_tabfill_to_airline_tabfill#%#airline_tabfill#%#airline_tabfill_to_airline_tablabel#%#airline_tablabel# buffers "
+ end
+
+ it 'Trigger on BufDelete autocommands'
+ e! CHANGELOG.md
+ sp CONTRIBUTING.md
+ sp README.md
+ 2bd
+ Expect airline#extensions#tabline#get() == "%#airline_tabhid#...%#airline_tabhid_to_airline_tab# %#airline_tab#%(%{airline#extensions#tabline#get_buffer_name(4)}%) | %(%{airline#extensions#tabline#get_buffer_name(5)}%) %#airline_tab_to_airline_tabsel# %#airline_tabsel#%(%{airline#extensions#tabline#get_buffer_name(6)}%) %#airline_tabsel_to_airline_tabfill# %#airline_tabfill#%=%#airline_tabfill_to_airline_tabfill#%#airline_tabfill#%#airline_tabfill_to_airline_tablabel#%#airline_tablabel# buffers "
+ end
+end
diff --git a/dotfiles/.local/share/nvim/site/t/highlighter.vim b/dotfiles/.local/share/nvim/site/t/highlighter.vim
new file mode 100644
index 0000000..a38a5c6
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/highlighter.vim
@@ -0,0 +1,20 @@
+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/dotfiles/.local/share/nvim/site/t/init.vim b/dotfiles/.local/share/nvim/site/t/init.vim
new file mode 100644
index 0000000..4f1340d
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/init.vim
@@ -0,0 +1,88 @@
+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, spell, iminsert'
+ Expect g:airline_section_a =~ 'mode'
+ Expect g:airline_section_a =~ 'paste'
+ Expect g:airline_section_a =~ 'spell'
+ 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#prepend("",0)}%{airline#util#prepend("",0)}%{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 =~ '%3v'
+ 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('ale_error_count').raw == ''
+ Expect airline#parts#get('ale_warning_count').raw == ''
+ Expect airline#parts#get('hunks').raw == ''
+ Expect airline#parts#get('branch').raw == ''
+ Expect airline#parts#get('eclim').raw == ''
+ 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 == ''
+ Expect airline#parts#get('whitespace').raw == ''
+ Expect airline#parts#get('windowswap').raw == ''
+ Expect airline#parts#get('ycm_error_count').raw == ''
+ Expect airline#parts#get('ycm_warning_count').raw == ''
+ Expect airline#parts#get('languageclient_error_count').raw == ''
+ Expect airline#parts#get('languageclient_warning_count').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/dotfiles/.local/share/nvim/site/t/parts.vim b/dotfiles/.local/share/nvim/site/t/parts.vim
new file mode 100644
index 0000000..5e30ca4
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/parts.vim
@@ -0,0 +1,38 @@
+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/dotfiles/.local/share/nvim/site/t/section.vim b/dotfiles/.local/share/nvim/site/t/section.vim
new file mode 100644
index 0000000..50717a7
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/section.vim
@@ -0,0 +1,80 @@
+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
+
+ it 'should not draw two separators after another'
+ let s = airline#section#create_right(['ffenc','%{strftime("%H:%M")}'])
+ Expect s == '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}'
+ end
+end
diff --git a/dotfiles/.local/share/nvim/site/t/themes.vim b/dotfiles/.local/share/nvim/site/t/themes.vim
new file mode 100644
index 0000000..bff302b
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/themes.vim
@@ -0,0 +1,72 @@
+describe 'themes'
+ after
+ highlight clear Foo
+ highlight clear Normal
+ end
+
+ it 'should extract correct colors'
+ call airline#highlighter#reset_hlcache()
+ 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'
+ call airline#highlighter#reset_hlcache()
+ 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'
+ call airline#highlighter#reset_hlcache()
+ 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'
+ call airline#highlighter#reset_hlcache()
+ hi clear Normal
+ let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
+ Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic']
+
+ let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold')
+ Expect hl == ['', '', 'NONE', 'NONE', '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/dotfiles/.local/share/nvim/site/t/util.vim b/dotfiles/.local/share/nvim/site/t/util.vim
new file mode 100644
index 0000000..516938c
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/t/util.vim
@@ -0,0 +1,53 @@
+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