0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.1524: tests are silently skipped

Problem:    Tests are silently skipped.
Solution:   Throw an exception for skipped tests in more places.
This commit is contained in:
Bram Moolenaar 2019-06-13 22:19:53 +02:00
parent 8d24104031
commit b0f94c1ff3
51 changed files with 115 additions and 65 deletions

View File

@ -330,7 +330,7 @@ endfunc
" Get line "lnum" as displayed on the screen. " Get line "lnum" as displayed on the screen.
" Trailing white space is trimmed. " Trailing white space is trimmed.
func! Screenline(lnum) func Screenline(lnum)
let chars = [] let chars = []
for c in range(1, winwidth(0)) for c in range(1, winwidth(0))
call add(chars, nr2char(screenchar(a:lnum, c))) call add(chars, nr2char(screenchar(a:lnum, c)))

View File

@ -222,6 +222,25 @@ func Test_override()
call assert_fails("call test_override('redraw', 'yes')", 'E474') call assert_fails("call test_override('redraw', 'yes')", 'E474')
endfunc endfunc
func Test_mouse_position()
let save_mouse = &mouse
set mouse=a
new
call setline(1, ['line one', 'line two'])
call assert_equal([0, 1, 1, 0], getpos('.'))
call test_setmouse(1, 5)
call feedkeys("\<LeftMouse>", "xt")
call assert_equal([0, 1, 5, 0], getpos('.'))
call test_setmouse(2, 20)
call feedkeys("\<LeftMouse>", "xt")
call assert_equal([0, 2, 8, 0], getpos('.'))
call test_setmouse(5, 1)
call feedkeys("\<LeftMouse>", "xt")
call assert_equal([0, 2, 1, 0], getpos('.'))
bwipe!
let &mouse = save_mouse
endfunc
func Test_user_is_happy() func Test_user_is_happy()
smile smile
sleep 300m sleep 300m

View File

@ -1,7 +1,7 @@
" Tests for encryption. " Tests for encryption.
if !has('cryptv') if !has('cryptv')
finish throw 'Skipped, encryption feature missing'
endif endif
func Common_head_only(text) func Common_head_only(text)

View File

@ -1,7 +1,10 @@
" Test for cscope commands. " Test for cscope commands.
if !has('cscope') || !executable('cscope') || !has('quickfix') if !has('cscope') || !has('quickfix')
finish throw 'Skipped, cscope or quickfix feature missing'
endif
if !executable('cscope')
throw 'Skipped, cscope program missing'
endif endif
func CscopeSetupOrClean(setup) func CscopeSetupOrClean(setup)

View File

@ -1,7 +1,7 @@
" Tests for digraphs " Tests for digraphs
if !has("digraphs") if !has("digraphs")
finish throw 'Skipped, digraphs feature missing'
endif endif
func Put_Dig(chars) func Put_Dig(chars)

View File

@ -1,7 +1,7 @@
" test float functions " test float functions
if !has('float') if !has('float')
finish throw 'Skipped, float feature missing'
end end
func Test_abs() func Test_abs()

View File

@ -2,7 +2,7 @@
source shared.vim source shared.vim
if !CanRunGui() if !CanRunGui()
finish throw 'Skipped, cannot run GUI'
endif endif
source setup_gui.vim source setup_gui.vim

View File

@ -3,7 +3,7 @@
source shared.vim source shared.vim
if !CanRunGui() if !CanRunGui()
finish throw 'Skipped, cannot run GUI'
endif endif
source setup_gui.vim source setup_gui.vim

View File

@ -1,7 +1,7 @@
" Tests for the history functions " Tests for the history functions
if !has('cmdline_hist') if !has('cmdline_hist')
finish throw 'Skipped, cmdline_hist feature missing'
endif endif
set history=7 set history=7

View File

@ -1,7 +1,7 @@
" tests for 'langmap' " tests for 'langmap'
if !has('langmap') if !has('langmap')
finish throw 'Skipped, langmap feature missing'
endif endif
func Test_langmap() func Test_langmap()

View File

@ -3,8 +3,11 @@
set encoding=latin1 set encoding=latin1
scriptencoding latin1 scriptencoding latin1
if !exists("+linebreak") || !has("conceal") if !exists("+linebreak")
finish throw 'Skipped, linebreak option missing'
endif
if !has("conceal")
throw 'Skipped, conceal feature missing'
endif endif
source view_util.vim source view_util.vim

View File

@ -3,8 +3,14 @@
set encoding=utf-8 set encoding=utf-8
scriptencoding utf-8 scriptencoding utf-8
if !exists("+linebreak") || !has("conceal") || !has("signs") if !exists("+linebreak")
finish throw 'Skipped, linebreak option missing'
endif
if !has("conceal")
throw 'Skipped, conceal feature missing'
endif
if !has("signs")
throw 'Skipped, signs feature missing'
endif endif
source view_util.vim source view_util.vim

View File

@ -1,7 +1,7 @@
" Tests for Lua. " Tests for Lua.
if !has('lua') if !has('lua')
finish throw 'Skipped, lua feature missing'
endif endif
func TearDown() func TearDown()

View File

@ -4,8 +4,7 @@ source shared.vim
let s:python = PythonProg() let s:python = PythonProg()
if s:python == '' if s:python == ''
" Can't run this test. throw 'Skipped, python program missing'
finish
endif endif
let s:script = 'test_makeencoding.py' let s:script = 'test_makeencoding.py'

View File

@ -1,6 +1,7 @@
" Test for matchadd() and conceal feature " Test for matchadd() and conceal feature
if !has('conceal') if !has('conceal')
finish throw 'Skipped, conceal feature missing'
endif endif
if !has('gui_running') && has('unix') if !has('gui_running') && has('unix')

View File

@ -1,6 +1,7 @@
" Test for matchadd() and conceal feature using utf-8. " Test for matchadd() and conceal feature using utf-8.
if !has('conceal') if !has('conceal')
finish throw 'Skipped, conceal feature missing'
endif endif
if !has('gui_running') && has('unix') if !has('gui_running') && has('unix')

View File

@ -1,9 +1,15 @@
" Tests for memory usage. " Tests for memory usage.
if !has('terminal') || has('gui_running') || $ASAN_OPTIONS !=# '' if !has('terminal')
throw 'Skipped, terminal feature missing'
endif
if has('gui_running')
throw 'Skipped, does not work in GUI'
endif
if $ASAN_OPTIONS !=# ''
" Skip tests on Travis CI ASAN build because it's difficult to estimate " Skip tests on Travis CI ASAN build because it's difficult to estimate
" memory usage. " memory usage.
finish throw 'Skipped, does not work with ASAN'
endif endif
source shared.vim source shared.vim
@ -14,7 +20,7 @@ endfunc
if has('win32') if has('win32')
if !executable('wmic') if !executable('wmic')
finish throw 'Skipped, wmic program missing'
endif endif
func s:memory_usage(pid) abort func s:memory_usage(pid) abort
let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid) let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid)
@ -22,13 +28,13 @@ if has('win32')
endfunc endfunc
elseif has('unix') elseif has('unix')
if !executable('ps') if !executable('ps')
finish throw 'Skipped, ps program missing'
endif endif
func s:memory_usage(pid) abort func s:memory_usage(pid) abort
return s:pick_nr(system('ps -o rss= -p ' . a:pid)) return s:pick_nr(system('ps -o rss= -p ' . a:pid))
endfunc endfunc
else else
finish throw 'Skipped, not win32 or unix'
endif endif
" Wait for memory usage to level off. " Wait for memory usage to level off.

View File

@ -1,7 +1,7 @@
" Test that the system menu can be loaded. " Test that the system menu can be loaded.
if !has('menu') if !has('menu')
finish throw 'Skipped, menu feature missing'
endif endif
func Test_load_menu() func Test_load_menu()

View File

@ -4,7 +4,7 @@ set encoding=latin1
scriptencoding latin1 scriptencoding latin1
if !has('mksession') if !has('mksession')
finish throw 'Skipped, mksession feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -4,7 +4,7 @@ set encoding=utf-8
scriptencoding utf-8 scriptencoding utf-8
if !has('mksession') if !has('mksession')
finish throw 'Skipped, mksession feature missing'
endif endif
func Test_mksession_utf8() func Test_mksession_utf8()

View File

@ -1,15 +1,14 @@
" Test the netbeans interface. " Test the netbeans interface.
if !has('netbeans_intg') if !has('netbeans_intg')
finish throw 'Skipped, netbeans_intg feature missing'
endif endif
source shared.vim source shared.vim
let s:python = PythonProg() let s:python = PythonProg()
if s:python == '' if s:python == ''
" Can't run this test. throw 'Skipped, python program missing'
finish
endif endif
" Run "testfunc" after sarting the server and stop the server afterwards. " Run "testfunc" after sarting the server and stop the server afterwards.

View File

@ -1,8 +1,11 @@
" Tests for bracketed paste and other forms of pasting. " Tests for bracketed paste and other forms of pasting.
" Bracketed paste only works with "xterm". Not in GUI or Windows console. " Bracketed paste only works with "xterm". Not in GUI or Windows console.
if has('gui_running') || has('win32') if has('win32')
finish throw 'Skipped, does not work on MS-Windows'
endif
if has('gui_running')
throw 'Skipped, does not work in the GUI'
endif endif
set term=xterm set term=xterm
@ -122,7 +125,6 @@ func Test_xrestore()
if !has('xterm_clipboard') if !has('xterm_clipboard')
return return
endif endif
call ch_logfile('logfile', 'w')
let display = $DISPLAY let display = $DISPLAY
new new
call CheckCopyPaste() call CheckCopyPaste()
@ -133,6 +135,5 @@ call ch_logfile('logfile', 'w')
exe "xrestore " .. display exe "xrestore " .. display
call CheckCopyPaste() call CheckCopyPaste()
call ch_logfile('', '')
bwipe! bwipe!
endfunc endfunc

View File

@ -1,7 +1,7 @@
" Tests for Perl interface " Tests for Perl interface
if !has('perl') if !has('perl')
finish throw 'Skipped, perl feature missing'
end end
" FIXME: RunTest don't see any error when Perl abort... " FIXME: RunTest don't see any error when Perl abort...

View File

@ -1,6 +1,7 @@
" Test Vim profiler " Test Vim profiler
if !has('profile') if !has('profile')
finish throw 'Skipped, profile feature missing'
endif endif
func Test_profile_func() func Test_profile_func()

View File

@ -1,7 +1,7 @@
" Tests for setting 'buftype' to "prompt" " Tests for setting 'buftype' to "prompt"
if !has('channel') if !has('channel')
finish throw 'Skipped, channel feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -2,7 +2,7 @@
" TODO: move tests from test87.in here. " TODO: move tests from test87.in here.
if !has('python') if !has('python')
finish throw 'Skipped, python feature missing'
endif endif
func Test_pydo() func Test_pydo()

View File

@ -2,7 +2,7 @@
" TODO: move tests from test88.in here. " TODO: move tests from test88.in here.
if !has('python3') if !has('python3')
finish throw 'Skipped, python3 feature missing'
endif endif
func Test_py3do() func Test_py3do()

View File

@ -2,7 +2,7 @@
set pyx=2 set pyx=2
if !has('python') if !has('python')
finish throw 'Skipped, python feature missing'
endif endif
let s:py2pattern = '^2\.[0-7]\.\d\+' let s:py2pattern = '^2\.[0-7]\.\d\+'

View File

@ -2,7 +2,7 @@
set pyx=3 set pyx=3
if !has('python3') if !has('python3')
finish throw 'Skipped, python3 feature missing'
endif endif
let s:py2pattern = '^2\.[0-7]\.\d\+' let s:py2pattern = '^2\.[0-7]\.\d\+'

View File

@ -1,7 +1,7 @@
" Test for the quickfix feature. " Test for the quickfix feature.
if !has('quickfix') if !has('quickfix')
finish throw 'Skipped, quickfix feature missing'
endif endif
set encoding=utf-8 set encoding=utf-8

View File

@ -2,7 +2,7 @@
source shared.vim source shared.vim
if !WorkingClipboard() if !WorkingClipboard()
finish throw 'Skipped, no working clipboard'
endif endif
source shared.vim source shared.vim

View File

@ -1,7 +1,10 @@
" Tests for reltime() " Tests for reltime()
if !has('reltime') || !has('float') if !has('reltime')
finish throw 'Skipped, reltime feature missing'
endif
if !has('float')
throw 'Skipped, float feature missing'
endif endif
func Test_reltime() func Test_reltime()

View File

@ -1,7 +1,7 @@
" Tests for ruby interface " Tests for ruby interface
if !has('ruby') if !has('ruby')
finish throw 'Skipped, ruby feature missing'
end end
func Test_ruby_change_buffer() func Test_ruby_change_buffer()

View File

@ -1,7 +1,10 @@
" Tests for the sha256() function. " Tests for the sha256() function.
if !has('cryptv') || !exists('*sha256') if !has('cryptv')
finish throw 'Skipped, cryptv feature missing'
endif
if !exists('*sha256')
throw 'Skipped, sha256 function missing'
endif endif
function Test_sha256() function Test_sha256()

View File

@ -2,7 +2,7 @@
" Only for use on Win32 systems! " Only for use on Win32 systems!
if !has('win32') if !has('win32')
finish throw 'Skipped, not on MS-Windows'
endif endif
func TestIt(file, bits, expected) func TestIt(file, bits, expected)

View File

@ -1,7 +1,7 @@
" Test signal handling. " Test signal handling.
if !has('unix') if !has('unix')
finish throw 'Skipped, not on Unix'
endif endif
source shared.vim source shared.vim

View File

@ -1,7 +1,7 @@
" Test for signs " Test for signs
if !has('signs') if !has('signs')
finish throw 'Skipped, signs feature missing'
endif endif
func Test_sign() func Test_sign()

View File

@ -1,7 +1,7 @@
" Test spell checking " Test spell checking
if !has('spell') if !has('spell')
finish throw 'Skipped, spell feature missing'
endif endif
func TearDown() func TearDown()

View File

@ -1,7 +1,7 @@
" Test for syntax and syntax iskeyword option " Test for syntax and syntax iskeyword option
if !has("syntax") if !has("syntax")
finish throw 'Skipped, syntax feature missing'
endif endif
source view_util.vim source view_util.vim

View File

@ -1,7 +1,7 @@
" Tests for the Tcl interface. " Tests for the Tcl interface.
if !has('tcl') if !has('tcl')
finish throw 'Skipped, tcl feature missing'
end end
" Helper function as there is no builtin tcleval() function similar " Helper function as there is no builtin tcleval() function similar

View File

@ -1,8 +1,11 @@
" Tests for decoding escape sequences sent by the terminal. " Tests for decoding escape sequences sent by the terminal.
" This only works for Unix in a terminal " This only works for Unix in a terminal
if has('gui_running') || !has('unix') if has('gui_running')
finish throw 'Skipped, does not work in the GUI'
endif
if !has('unix')
throw 'Skipped, not on Unix'
endif endif
source shared.vim source shared.vim

View File

@ -1,7 +1,7 @@
" Tests for the terminal window. " Tests for the terminal window.
if !has('terminal') if !has('terminal')
finish throw 'Skipped, terminal feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -3,7 +3,7 @@
" freed. Since the process exists right away it's not a real leak. " freed. Since the process exists right away it's not a real leak.
if !has('terminal') if !has('terminal')
finish throw 'Skipped, terminal feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -1,7 +1,7 @@
" Test for textobjects " Test for textobjects
if !has('textobjects') if !has('textobjects')
finish throw 'Skipped, textobjects feature missing'
endif endif
func CpoM(line, useM, expected) func CpoM(line, useM, expected)

View File

@ -2,7 +2,7 @@
" buffer. " buffer.
if !has('textprop') if !has('textprop')
finish throw 'Skipped, textprop feature missing'
endif endif
source screendump.vim source screendump.vim

View File

@ -1,7 +1,7 @@
" Test for timers " Test for timers
if !has('timers') if !has('timers')
finish throw 'Skipped, timers feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -1,7 +1,7 @@
" Test for variable tabstops " Test for variable tabstops
if !has("vartabs") if !has("vartabs")
finish throw 'Skipped, vartabs feature missing'
endif endif
source view_util.vim source view_util.vim

View File

@ -1,7 +1,7 @@
" Test WinBar " Test WinBar
if !has('menu') if !has('menu')
finish throw 'Skipped, menu feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -1,7 +1,7 @@
" Test for $HOME on Windows. " Test for $HOME on Windows.
if !has('win32') if !has('win32')
finish throw 'Skipped, not on MS-Windows'
endif endif
let s:env = {} let s:env = {}

View File

@ -2,7 +2,7 @@
if empty($XXD) && executable('..\xxd\xxd.exe') if empty($XXD) && executable('..\xxd\xxd.exe')
let s:xxd_cmd = '..\xxd\xxd.exe' let s:xxd_cmd = '..\xxd\xxd.exe'
elseif empty($XXD) || !executable($XXD) elseif empty($XXD) || !executable($XXD)
finish throw 'Skipped, xxd program missing'
else else
let s:xxd_cmd = $XXD let s:xxd_cmd = $XXD
endif endif

View File

@ -777,6 +777,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1524,
/**/ /**/
1523, 1523,
/**/ /**/