diff options
Diffstat (limited to '')
-rwxr-xr-x | tests/test_vim/tests/commandt_plugin.vim | 17 | ||||
-rwxr-xr-x | tests/test_vim/tests/empty_encoding.old.vim | 32 | ||||
-rw-r--r-- | tests/test_vim/tests/foreign_stl_override.vim | 22 | ||||
-rw-r--r-- | tests/test_vim/tests/invalid_unicode.vim | 19 | ||||
-rwxr-xr-x | tests/test_vim/tests/local_overrides.vim | 48 | ||||
-rwxr-xr-x | tests/test_vim/tests/nerdtree_plugin.vim | 11 | ||||
-rwxr-xr-x | tests/test_vim/tests/plugin_file.vim | 22 | ||||
-rwxr-xr-x | tests/test_vim/tests/tabline.vim | 56 |
8 files changed, 227 insertions, 0 deletions
diff --git a/tests/test_vim/tests/commandt_plugin.vim b/tests/test_vim/tests/commandt_plugin.vim new file mode 100755 index 0000000..9f944b9 --- /dev/null +++ b/tests/test_vim/tests/commandt_plugin.vim @@ -0,0 +1,17 @@ +#!/usr/bin/vim -S +set nocompatible +set columns=80 +execute 'source' fnameescape(expand('<sfile>:p:h:h').'/vim_utils.vim') +call EnablePlugins('command-t') +call SourcePowerline() +let g:statusline_values = [] +call PyFile('setup_statusline_catcher') +execute 'CommandTBuffer'|call feedkeys("\<C-c>") +call RunPython('powerline.render = _powerline_old_render') +let g:expected_statusline = '%#Pl_231_16777215_240_5789784_bold# Command-T %#Pl_231_16777215_240_5789784_NONE# %#Pl_231_16777215_240_5789784_bold#BufferFinder %#Pl_240_5789784_236_3158064_NONE# %#Pl_231_16777215_236_3158064_NONE# ' +call CheckMessages() +if index(g:statusline_values, g:expected_statusline) == -1 + call CheckStatuslineValue(get(g:statusline_values, -1, ''), g:expected_statusline) + cquit +endif +qall diff --git a/tests/test_vim/tests/empty_encoding.old.vim b/tests/test_vim/tests/empty_encoding.old.vim new file mode 100755 index 0000000..124a10a --- /dev/null +++ b/tests/test_vim/tests/empty_encoding.old.vim @@ -0,0 +1,32 @@ +#!/usr/bin/vim -S +if has('multi_byte') + if empty(&encoding) + call writefile(['&encoding option value is empty, even though Vim has +multibyte'], 'message.fail') + cquit + endif + qall +endif +if !empty(&encoding) + call writefile(['&encoding option value is not empty, even though Vim does not have +multibyte'], 'message.fail') + cquit +endif + +let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files'] + +try + source <sfile>:p:h:h:h:h/powerline/bindings/vim/plugin/powerline.vim +catch + call writefile(['Unexpected exception:', v:exception], 'message.fail') + cquit +endtry +set ls=2 +redrawstatus! +redir => g:messages + messages +redir END +let mess=split(g:messages, "\n") +if len(mess)>1 + call writefile(['Unexpected message(s):']+mess, 'message.fail') + cquit +endif +qall! diff --git a/tests/test_vim/tests/foreign_stl_override.vim b/tests/test_vim/tests/foreign_stl_override.vim new file mode 100644 index 0000000..2a5b8c0 --- /dev/null +++ b/tests/test_vim/tests/foreign_stl_override.vim @@ -0,0 +1,22 @@ +scriptencoding utf-8 +set encoding=utf-8 +let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files'] +set laststatus=2 +redir => g:messages + try + source <sfile>:p:h:h:h:h/powerline/bindings/vim/plugin/powerline.vim + redrawstatus! + vsplit + redrawstatus! + setlocal statusline=«» + redrawstatus! + catch + call writefile(['Unexpected exception', v:exception], 'message.fail') + cquit + endtry +redir END +if g:messages =~# '\v\S' + call writefile(['Unexpected messages'] + split(g:messages, "\n", 1), 'message.fail') + cquit +endif +qall! diff --git a/tests/test_vim/tests/invalid_unicode.vim b/tests/test_vim/tests/invalid_unicode.vim new file mode 100644 index 0000000..ac91f3c --- /dev/null +++ b/tests/test_vim/tests/invalid_unicode.vim @@ -0,0 +1,19 @@ +set encoding=utf-8 +let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files'] +set laststatus=2 +set showtabline=2 +edit `="\xFF"` +redir => g:messages + try + source <sfile>:p:h:h:h:h/powerline/bindings/vim/plugin/powerline.vim + redrawstatus! + catch + call writefile(['Unexpected exception', v:exception], 'message.fail') + cquit + endtry +redir END +if g:messages =~# '\v\S' + call writefile(['Unexpected messages'] + split(g:messages, "\n", 1), 'message.fail') + cquit +endif +qall! diff --git a/tests/test_vim/tests/local_overrides.vim b/tests/test_vim/tests/local_overrides.vim new file mode 100755 index 0000000..aba14e2 --- /dev/null +++ b/tests/test_vim/tests/local_overrides.vim @@ -0,0 +1,48 @@ +#!/usr/bin/vim -S +set encoding=utf-8 +let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files'] +let g:powerline_config_overrides = {'common': {'default_top_theme': 'ascii'}} +let g:powerline_theme_overrides = {'default': {'segment_data': {'line_current_symbol': {'contents': 'LN '}, 'branch': {'before': 'B '}}}} + +redir => g:messages + +try + python import powerline.vim + let pycmd = 'python' +catch + try + python3 import powerline.vim + let pycmd = 'python3' + catch + call writefile(['Unable to determine python version', v:exception], 'message.fail') + cquit + endtry +endtry + +try + execute pycmd 'powerline.vim.setup()' +catch + call writefile(['Failed to run setup function', v:exception], 'message.fail') + cquit +endtry + +try + let &columns = 80 + let result = eval(&statusline[2:]) +catch + call writefile(['Exception while evaluating &stl', v:exception], 'message.fail') + cquit +endtry + +if result isnot# '%#Pl_22_24320_148_11523840_bold# NORMAL %#Pl_148_11523840_236_3158064_NONE# %#Pl_231_16777215_236_3158064_NONE# %#Pl_247_10395294_236_3158064_NONE#unix%#Pl_240_5789784_236_3158064_NONE# %#Pl_247_10329757_240_5789784_NONE# 100%%%#Pl_252_13684944_240_5789784_NONE# %#Pl_235_2500134_252_13684944_NONE# LN %#Pl_235_2500134_252_13684944_bold# 1%#Pl_22_24576_252_13684944_NONE#:1 ' + call writefile(['Unexpected result', result], 'message.fail') + cquit +endif + +redir END +if g:messages =~ '\S' + call writefile(['Non-empty messages:', g:messages], 'message.fail') + cquit +endif + +qall! diff --git a/tests/test_vim/tests/nerdtree_plugin.vim b/tests/test_vim/tests/nerdtree_plugin.vim new file mode 100755 index 0000000..761cb5f --- /dev/null +++ b/tests/test_vim/tests/nerdtree_plugin.vim @@ -0,0 +1,11 @@ +#!/usr/bin/vim -S +set nocompatible +set columns=80 +execute 'source' fnameescape(expand('<sfile>:p:h:h').'/vim_utils.vim') +call EnablePlugins('nerdtree') +call SourcePowerline() +NERDTree /home +redrawstatus +call CheckCurrentStatusline('%#Pl_231_16777215_240_5789784_bold# /home %#Pl_240_5789784_236_3158064_NONE# %#Pl_231_16777215_236_3158064_NONE# ') +call CheckMessages() +qall diff --git a/tests/test_vim/tests/plugin_file.vim b/tests/test_vim/tests/plugin_file.vim new file mode 100755 index 0000000..1848933 --- /dev/null +++ b/tests/test_vim/tests/plugin_file.vim @@ -0,0 +1,22 @@ +#!/usr/bin/vim -S +set encoding=utf-8 +let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files'] +tabedit abc +tabedit def +try + source <sfile>:p:h:h:h:h/powerline/bindings/vim/plugin/powerline.vim +catch + call writefile([v:exception], 'message.fail') + cquit +endtry +set ls=2 +redrawstatus! +redir =>mes + messages +redir END +let mess=split(mes, "\n") +if len(mess)>1 + call writefile(mess, 'message.fail') + cquit +endif +qall! diff --git a/tests/test_vim/tests/tabline.vim b/tests/test_vim/tests/tabline.vim new file mode 100755 index 0000000..ff76dc0 --- /dev/null +++ b/tests/test_vim/tests/tabline.vim @@ -0,0 +1,56 @@ +#!/usr/bin/vim -S +set encoding=utf-8 +let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files'] +source <sfile>:p:h:h:h:h/powerline/bindings/vim/plugin/powerline.vim +edit abc +tabedit def +tabedit ghi + +redir => g:messages + +try + let &columns = 80 + let result = eval(&tabline[2:]) +catch + call writefile(['Exception while evaluating &tabline', v:exception], 'message.fail') + cquit +endtry + +if result isnot# '%1T%#Pl_247_10395294_236_3158064_NONE# 1 ./abc %#Pl_244_8421504_236_3158064_NONE# %2T%#Pl_247_10395294_236_3158064_NONE#2 ./def %#Pl_236_3158064_240_5789784_NONE# %3T%#Pl_250_12369084_240_5789784_NONE#3 ./%#Pl_231_16777215_240_5789784_bold#ghi %#Pl_240_5789784_236_3158064_NONE# %T%#Pl_231_16777215_236_3158064_NONE# %#Pl_252_13684944_236_3158064_NONE# %#Pl_235_2500134_252_13684944_bold# Tabs ' + call writefile(['Unexpected tabline', result], 'message.fail') + cquit +endif + +tabonly! + +try + let result = eval(&tabline[2:]) +catch + call writefile(['Exception while evaluating &tabline (2)', v:exception], 'message.fail') + cquit +endtry + +if result isnot# '%T%#Pl_247_10395294_236_3158064_NONE# 1 ./abc %#Pl_244_8421504_236_3158064_NONE# %#Pl_247_10395294_236_3158064_NONE#2 ./def %#Pl_236_3158064_240_5789784_NONE# %#Pl_250_12369084_240_5789784_NONE#3 ./%#Pl_231_16777215_240_5789784_bold#ghi %#Pl_240_5789784_236_3158064_NONE# %#Pl_231_16777215_236_3158064_NONE# %#Pl_252_13684944_236_3158064_NONE# %#Pl_235_2500134_252_13684944_bold# Bufs ' + call writefile(['Unexpected tabline (2)', result], 'message.fail') + cquit +endif + +try + vsplit + let result = eval(&tabline[2:]) +catch + call writefile(['Exception while evaluating &tabline (3)', v:exception], 'message.fail') +endtry + +if result isnot# '%T%#Pl_247_10395294_236_3158064_NONE# 1 ./abc %#Pl_244_8421504_236_3158064_NONE# %#Pl_247_10395294_236_3158064_NONE#2 ./def %#Pl_236_3158064_240_5789784_NONE# %#Pl_250_12369084_240_5789784_NONE#3 ./%#Pl_231_16777215_240_5789784_bold#ghi %#Pl_240_5789784_236_3158064_NONE# %#Pl_231_16777215_236_3158064_NONE# %#Pl_252_13684944_236_3158064_NONE# %#Pl_235_2500134_252_13684944_bold# Bufs ' + call writefile(['Unexpected tabline (3)', result], 'message.fail') + cquit +endif + +redir END +if g:messages =~ '\S' + call writefile(['Non-empty messages:', g:messages], 'message.fail') + cquit +endif + +qall! |