From fb711ba9a9265f35d9519b0a19f25b1c38e2b55f Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sat, 31 Aug 2013 12:03:39 -0400 Subject: [PATCH] test funcref pipeline. --- t/airline.vim | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 t/airline.vim diff --git a/t/airline.vim b/t/airline.vim new file mode 100644 index 0000000..b31251e --- /dev/null +++ b/t/airline.vim @@ -0,0 +1,46 @@ +call airline#init#bootstrap() + +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 &statusline =~ '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 &statusline =~ 'helloworld' + end +end +