Move vim integration tests to test_vim

This commit is contained in:
Foo 2017-04-30 15:19:24 +03:00
parent c30383a194
commit 82ca32edc9
11 changed files with 28 additions and 22 deletions

View File

@ -12,28 +12,33 @@ export POWERLINE_THEME_OVERRIDES='default.segments.left=[]'
test_script() {
local vim="$1"
local script="$2"
local test_name_prefix="$3"
echo "Running script $script with $vim"
if ! test -e "$vim" ; then
return 0
fi
if ! "$vim" -u NONE -S "$script" || test -f message.fail ; then
local test_name="$test_name_prefix-${script##*/}"
if ! script="$script" "$vim" -u NONE -c 'source $script' \
|| test -f message.fail
then
local test_name="${script##*/}"
fail "${test_name%.vim}" F "Failed script $script run with $vim"
cat message.fail >&2
rm message.fail
if test -e message.fail ; then
cat message.fail >&2
rm message.fail
fi
fi
}
for script in tests/test_*.vim ; do
TEST_SCRIPT_ROOT="$ROOT/tests/test_vim/tests"
for script in "$TEST_SCRIPT_ROOT"/*.vim ; do
if test "${script%.old.vim}" = "${script}" ; then
test_script "$NEW_VIM" "$script" new
test_script "$NEW_VIM" "$script"
fi
done
if test -e "$OLD_VIM" ; then
for script in tests/test_*.old.vim ; do
test_script "$OLD_VIM" "$script" old
for script in "$TEST_SCRIPT_ROOT"/*.old.vim ; do
test_script "$OLD_VIM" "$script"
done
fi

View File

@ -1,7 +1,7 @@
#!/usr/bin/vim -S
set nocompatible
set columns=80
execute 'source' fnameescape(expand('<sfile>:p:h').'/vim_utils.vim')
execute 'source' fnameescape(expand('<sfile>:p:h:h').'/vim_utils.vim')
call EnablePlugins('command-t')
call SourcePowerline()
let g:statusline_values = []
@ -9,9 +9,9 @@ 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
call CheckMessages()
qall

View File

@ -11,7 +11,7 @@ if !empty(&encoding)
cquit
endif
let g:powerline_config_paths = [expand('<sfile>:p:h:h') . '/powerline/config_files']
let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files']
try
source powerline/bindings/vim/plugin/powerline.vim

View File

@ -1,6 +1,6 @@
scriptencoding utf-8
set encoding=utf-8
let g:powerline_config_paths = [expand('<sfile>:p:h:h') . '/powerline/config_files']
let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files']
set laststatus=2
redir => g:messages
try

View File

@ -1,5 +1,5 @@
set encoding=utf-8
let g:powerline_config_paths = [expand('<sfile>:p:h:h') . '/powerline/config_files']
let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files']
set laststatus=2
set showtabline=2
edit `="\xFF"`

View File

@ -1,6 +1,6 @@
#!/usr/bin/vim -S
set encoding=utf-8
let g:powerline_config_paths = [expand('<sfile>:p:h:h') . '/powerline/config_files']
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 '}}}}

View File

@ -1,7 +1,7 @@
#!/usr/bin/vim -S
set nocompatible
set columns=80
execute 'source' fnameescape(expand('<sfile>:p:h').'/vim_utils.vim')
execute 'source' fnameescape(expand('<sfile>:p:h:h').'/vim_utils.vim')
call EnablePlugins('nerdtree')
call SourcePowerline()
NERDTree /home

View File

@ -1,6 +1,6 @@
#!/usr/bin/vim -S
set encoding=utf-8
let g:powerline_config_paths = [expand('<sfile>:p:h:h') . '/powerline/config_files']
let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files']
tabedit abc
tabedit def
try

View File

@ -1,6 +1,6 @@
#!/usr/bin/vim -S
set encoding=utf-8
let g:powerline_config_paths = [expand('<sfile>:p:h:h') . '/powerline/config_files']
let g:powerline_config_paths = [expand('<sfile>:p:h:h:h:h') . '/powerline/config_files']
source powerline/bindings/vim/plugin/powerline.vim
edit abc
tabedit def

View File

@ -1,9 +1,10 @@
let g:powerline_use_var_handler = 1
let g:root=expand('<sfile>:p:h:h')
let g:pyfiles_root=expand('<sfile>:p:h').'/pyfiles'
let g:root=expand('<sfile>:p:h:h:h')
let g:mf=g:root.'/message.fail'
command -nargs=1 LST :call writefile(<args>, g:mf) | cquit
command -nargs=1 LST :call writefile(<args>, g:mf, 'a') | cquit
command -nargs=1 ERR :LST [<args>]
command -nargs=1 EXC :ERR 'Unexpected exception', <q-args>, v:exception, v:throwpoint
@ -76,9 +77,9 @@ function RunPython(s)
endfunction
function PyFile(f)
if has('python')
execute 'pyfile' fnameescape(g:root.'/tests/'.a:f.'.py')
execute 'pyfile' fnameescape(g:pyfiles_root.'/'.a:f.'.py')
else
execute 'py3file' fnameescape(g:root.'/tests/'.a:f.'.py')
execute 'py3file' fnameescape(g:pyfiles_root.'/'.a:f.'.py')
endif
endfunction