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() { test_script() {
local vim="$1" local vim="$1"
local script="$2" local script="$2"
local test_name_prefix="$3"
echo "Running script $script with $vim" echo "Running script $script with $vim"
if ! test -e "$vim" ; then if ! test -e "$vim" ; then
return 0 return 0
fi fi
if ! "$vim" -u NONE -S "$script" || test -f message.fail ; then if ! script="$script" "$vim" -u NONE -c 'source $script' \
local test_name="$test_name_prefix-${script##*/}" || test -f message.fail
then
local test_name="${script##*/}"
fail "${test_name%.vim}" F "Failed script $script run with $vim" fail "${test_name%.vim}" F "Failed script $script run with $vim"
cat message.fail >&2 if test -e message.fail ; then
rm message.fail cat message.fail >&2
rm message.fail
fi
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 if test "${script%.old.vim}" = "${script}" ; then
test_script "$NEW_VIM" "$script" new test_script "$NEW_VIM" "$script"
fi fi
done done
if test -e "$OLD_VIM" ; then if test -e "$OLD_VIM" ; then
for script in tests/test_*.old.vim ; do for script in "$TEST_SCRIPT_ROOT"/*.old.vim ; do
test_script "$OLD_VIM" "$script" old test_script "$OLD_VIM" "$script"
done done
fi fi

View File

@ -1,7 +1,7 @@
#!/usr/bin/vim -S #!/usr/bin/vim -S
set nocompatible set nocompatible
set columns=80 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 EnablePlugins('command-t')
call SourcePowerline() call SourcePowerline()
let g:statusline_values = [] let g:statusline_values = []
@ -9,9 +9,9 @@ call PyFile('setup_statusline_catcher')
execute 'CommandTBuffer'|call feedkeys("\<C-c>") execute 'CommandTBuffer'|call feedkeys("\<C-c>")
call RunPython('powerline.render = _powerline_old_render') 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#                                                    ' 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 if index(g:statusline_values, g:expected_statusline) == -1
call CheckStatuslineValue(get(g:statusline_values, -1, ''), g:expected_statusline) call CheckStatuslineValue(get(g:statusline_values, -1, ''), g:expected_statusline)
cquit cquit
endif endif
call CheckMessages()
qall qall

View File

@ -11,7 +11,7 @@ if !empty(&encoding)
cquit cquit
endif 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 try
source powerline/bindings/vim/plugin/powerline.vim source powerline/bindings/vim/plugin/powerline.vim

View File

@ -1,6 +1,6 @@
scriptencoding utf-8 scriptencoding utf-8
set encoding=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 set laststatus=2
redir => g:messages redir => g:messages
try try

View File

@ -1,5 +1,5 @@
set encoding=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 set laststatus=2
set showtabline=2 set showtabline=2
edit `="\xFF"` edit `="\xFF"`

View File

@ -1,6 +1,6 @@
#!/usr/bin/vim -S #!/usr/bin/vim -S
set encoding=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']
let g:powerline_config_overrides = {'common': {'default_top_theme': 'ascii'}} 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 '}}}} 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 #!/usr/bin/vim -S
set nocompatible set nocompatible
set columns=80 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 EnablePlugins('nerdtree')
call SourcePowerline() call SourcePowerline()
NERDTree /home NERDTree /home

View File

@ -1,6 +1,6 @@
#!/usr/bin/vim -S #!/usr/bin/vim -S
set encoding=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']
tabedit abc tabedit abc
tabedit def tabedit def
try try

View File

@ -1,6 +1,6 @@
#!/usr/bin/vim -S #!/usr/bin/vim -S
set encoding=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']
source powerline/bindings/vim/plugin/powerline.vim source powerline/bindings/vim/plugin/powerline.vim
edit abc edit abc
tabedit def tabedit def

View File

@ -1,9 +1,10 @@
let g:powerline_use_var_handler = 1 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' 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 ERR :LST [<args>]
command -nargs=1 EXC :ERR 'Unexpected exception', <q-args>, v:exception, v:throwpoint command -nargs=1 EXC :ERR 'Unexpected exception', <q-args>, v:exception, v:throwpoint
@ -76,9 +77,9 @@ function RunPython(s)
endfunction endfunction
function PyFile(f) function PyFile(f)
if has('python') if has('python')
execute 'pyfile' fnameescape(g:root.'/tests/'.a:f.'.py') execute 'pyfile' fnameescape(g:pyfiles_root.'/'.a:f.'.py')
else else
execute 'py3file' fnameescape(g:root.'/tests/'.a:f.'.py') execute 'py3file' fnameescape(g:pyfiles_root.'/'.a:f.'.py')
endif endif
endfunction endfunction