patch 8.1.1524: tests are silently skipped
Problem: Tests are silently skipped.
Solution: Throw an exception for skipped tests in more places.
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 4546be7..ae023a7 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -330,7 +330,7 @@
" Get line "lnum" as displayed on the screen.
" Trailing white space is trimmed.
-func! Screenline(lnum)
+func Screenline(lnum)
let chars = []
for c in range(1, winwidth(0))
call add(chars, nr2char(screenchar(a:lnum, c)))
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim
index 7df641c..0d59a43 100644
--- a/src/testdir/test_assert.vim
+++ b/src/testdir/test_assert.vim
@@ -222,6 +222,25 @@
call assert_fails("call test_override('redraw', 'yes')", 'E474')
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()
smile
sleep 300m
diff --git a/src/testdir/test_crypt.vim b/src/testdir/test_crypt.vim
index bf1a511..db10099 100644
--- a/src/testdir/test_crypt.vim
+++ b/src/testdir/test_crypt.vim
@@ -1,7 +1,7 @@
" Tests for encryption.
if !has('cryptv')
- finish
+ throw 'Skipped, encryption feature missing'
endif
func Common_head_only(text)
diff --git a/src/testdir/test_cscope.vim b/src/testdir/test_cscope.vim
index 7795ac7..a3fcbd7 100644
--- a/src/testdir/test_cscope.vim
+++ b/src/testdir/test_cscope.vim
@@ -1,7 +1,10 @@
" Test for cscope commands.
-if !has('cscope') || !executable('cscope') || !has('quickfix')
- finish
+if !has('cscope') || !has('quickfix')
+ throw 'Skipped, cscope or quickfix feature missing'
+endif
+if !executable('cscope')
+ throw 'Skipped, cscope program missing'
endif
func CscopeSetupOrClean(setup)
diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim
index 8d56a1a..92d4e47 100644
--- a/src/testdir/test_digraph.vim
+++ b/src/testdir/test_digraph.vim
@@ -1,7 +1,7 @@
" Tests for digraphs
if !has("digraphs")
- finish
+ throw 'Skipped, digraphs feature missing'
endif
func Put_Dig(chars)
diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim
index 29bfc9e..6340b53 100644
--- a/src/testdir/test_float_func.vim
+++ b/src/testdir/test_float_func.vim
@@ -1,7 +1,7 @@
" test float functions
if !has('float')
- finish
+ throw 'Skipped, float feature missing'
end
func Test_abs()
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim
index 5a1763d..d030a6a 100644
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -2,7 +2,7 @@
source shared.vim
if !CanRunGui()
- finish
+ throw 'Skipped, cannot run GUI'
endif
source setup_gui.vim
diff --git a/src/testdir/test_gui_init.vim b/src/testdir/test_gui_init.vim
index 638708f..a8eefa5 100644
--- a/src/testdir/test_gui_init.vim
+++ b/src/testdir/test_gui_init.vim
@@ -3,7 +3,7 @@
source shared.vim
if !CanRunGui()
- finish
+ throw 'Skipped, cannot run GUI'
endif
source setup_gui.vim
diff --git a/src/testdir/test_history.vim b/src/testdir/test_history.vim
index 16aad98..4b46413 100644
--- a/src/testdir/test_history.vim
+++ b/src/testdir/test_history.vim
@@ -1,7 +1,7 @@
" Tests for the history functions
if !has('cmdline_hist')
- finish
+ throw 'Skipped, cmdline_hist feature missing'
endif
set history=7
diff --git a/src/testdir/test_langmap.vim b/src/testdir/test_langmap.vim
index 572fad7..4b260f8 100644
--- a/src/testdir/test_langmap.vim
+++ b/src/testdir/test_langmap.vim
@@ -1,7 +1,7 @@
" tests for 'langmap'
if !has('langmap')
- finish
+ throw 'Skipped, langmap feature missing'
endif
func Test_langmap()
diff --git a/src/testdir/test_listlbr.vim b/src/testdir/test_listlbr.vim
index 29e797d..5af4133 100644
--- a/src/testdir/test_listlbr.vim
+++ b/src/testdir/test_listlbr.vim
@@ -3,8 +3,11 @@
set encoding=latin1
scriptencoding latin1
-if !exists("+linebreak") || !has("conceal")
- finish
+if !exists("+linebreak")
+ throw 'Skipped, linebreak option missing'
+endif
+if !has("conceal")
+ throw 'Skipped, conceal feature missing'
endif
source view_util.vim
diff --git a/src/testdir/test_listlbr_utf8.vim b/src/testdir/test_listlbr_utf8.vim
index c38e0c5..1154d66 100644
--- a/src/testdir/test_listlbr_utf8.vim
+++ b/src/testdir/test_listlbr_utf8.vim
@@ -3,8 +3,14 @@
set encoding=utf-8
scriptencoding utf-8
-if !exists("+linebreak") || !has("conceal") || !has("signs")
- finish
+if !exists("+linebreak")
+ throw 'Skipped, linebreak option missing'
+endif
+if !has("conceal")
+ throw 'Skipped, conceal feature missing'
+endif
+if !has("signs")
+ throw 'Skipped, signs feature missing'
endif
source view_util.vim
diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim
index 604cfed..5d2f088 100644
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -1,7 +1,7 @@
" Tests for Lua.
if !has('lua')
- finish
+ throw 'Skipped, lua feature missing'
endif
func TearDown()
diff --git a/src/testdir/test_makeencoding.vim b/src/testdir/test_makeencoding.vim
index d18b3b6..6de3c70 100644
--- a/src/testdir/test_makeencoding.vim
+++ b/src/testdir/test_makeencoding.vim
@@ -4,8 +4,7 @@
let s:python = PythonProg()
if s:python == ''
- " Can't run this test.
- finish
+ throw 'Skipped, python program missing'
endif
let s:script = 'test_makeencoding.py'
diff --git a/src/testdir/test_matchadd_conceal.vim b/src/testdir/test_matchadd_conceal.vim
index 8d774a0..a7c8b06 100644
--- a/src/testdir/test_matchadd_conceal.vim
+++ b/src/testdir/test_matchadd_conceal.vim
@@ -1,6 +1,7 @@
" Test for matchadd() and conceal feature
+
if !has('conceal')
- finish
+ throw 'Skipped, conceal feature missing'
endif
if !has('gui_running') && has('unix')
diff --git a/src/testdir/test_matchadd_conceal_utf8.vim b/src/testdir/test_matchadd_conceal_utf8.vim
index d280c15..fb27577 100644
--- a/src/testdir/test_matchadd_conceal_utf8.vim
+++ b/src/testdir/test_matchadd_conceal_utf8.vim
@@ -1,6 +1,7 @@
" Test for matchadd() and conceal feature using utf-8.
+
if !has('conceal')
- finish
+ throw 'Skipped, conceal feature missing'
endif
if !has('gui_running') && has('unix')
diff --git a/src/testdir/test_memory_usage.vim b/src/testdir/test_memory_usage.vim
index 8c2f8f7..eadd4ea 100644
--- a/src/testdir/test_memory_usage.vim
+++ b/src/testdir/test_memory_usage.vim
@@ -1,9 +1,15 @@
" 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
" memory usage.
- finish
+ throw 'Skipped, does not work with ASAN'
endif
source shared.vim
@@ -14,7 +20,7 @@
if has('win32')
if !executable('wmic')
- finish
+ throw 'Skipped, wmic program missing'
endif
func s:memory_usage(pid) abort
let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid)
@@ -22,13 +28,13 @@
endfunc
elseif has('unix')
if !executable('ps')
- finish
+ throw 'Skipped, ps program missing'
endif
func s:memory_usage(pid) abort
return s:pick_nr(system('ps -o rss= -p ' . a:pid))
endfunc
else
- finish
+ throw 'Skipped, not win32 or unix'
endif
" Wait for memory usage to level off.
diff --git a/src/testdir/test_menu.vim b/src/testdir/test_menu.vim
index b57fdc3..99f888a 100644
--- a/src/testdir/test_menu.vim
+++ b/src/testdir/test_menu.vim
@@ -1,7 +1,7 @@
" Test that the system menu can be loaded.
if !has('menu')
- finish
+ throw 'Skipped, menu feature missing'
endif
func Test_load_menu()
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index bc41396..ee2d148 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -4,7 +4,7 @@
scriptencoding latin1
if !has('mksession')
- finish
+ throw 'Skipped, mksession feature missing'
endif
source shared.vim
diff --git a/src/testdir/test_mksession_utf8.vim b/src/testdir/test_mksession_utf8.vim
index 36f0751..6bf5823 100644
--- a/src/testdir/test_mksession_utf8.vim
+++ b/src/testdir/test_mksession_utf8.vim
@@ -4,7 +4,7 @@
scriptencoding utf-8
if !has('mksession')
- finish
+ throw 'Skipped, mksession feature missing'
endif
func Test_mksession_utf8()
diff --git a/src/testdir/test_netbeans.vim b/src/testdir/test_netbeans.vim
index 66177ad..836bddf 100644
--- a/src/testdir/test_netbeans.vim
+++ b/src/testdir/test_netbeans.vim
@@ -1,15 +1,14 @@
" Test the netbeans interface.
if !has('netbeans_intg')
- finish
+ throw 'Skipped, netbeans_intg feature missing'
endif
source shared.vim
let s:python = PythonProg()
if s:python == ''
- " Can't run this test.
- finish
+ throw 'Skipped, python program missing'
endif
" Run "testfunc" after sarting the server and stop the server afterwards.
diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim
index 29206b94..ee69641 100644
--- a/src/testdir/test_paste.vim
+++ b/src/testdir/test_paste.vim
@@ -1,8 +1,11 @@
" Tests for bracketed paste and other forms of pasting.
" Bracketed paste only works with "xterm". Not in GUI or Windows console.
-if has('gui_running') || has('win32')
- finish
+if has('win32')
+ throw 'Skipped, does not work on MS-Windows'
+endif
+if has('gui_running')
+ throw 'Skipped, does not work in the GUI'
endif
set term=xterm
@@ -122,7 +125,6 @@
if !has('xterm_clipboard')
return
endif
-call ch_logfile('logfile', 'w')
let display = $DISPLAY
new
call CheckCopyPaste()
@@ -133,6 +135,5 @@
exe "xrestore " .. display
call CheckCopyPaste()
-call ch_logfile('', '')
bwipe!
endfunc
diff --git a/src/testdir/test_perl.vim b/src/testdir/test_perl.vim
index e24c04f..d38fc07 100644
--- a/src/testdir/test_perl.vim
+++ b/src/testdir/test_perl.vim
@@ -1,7 +1,7 @@
" Tests for Perl interface
if !has('perl')
- finish
+ throw 'Skipped, perl feature missing'
end
" FIXME: RunTest don't see any error when Perl abort...
diff --git a/src/testdir/test_profile.vim b/src/testdir/test_profile.vim
index ae47a6d..ddabe3a 100644
--- a/src/testdir/test_profile.vim
+++ b/src/testdir/test_profile.vim
@@ -1,6 +1,7 @@
" Test Vim profiler
+
if !has('profile')
- finish
+ throw 'Skipped, profile feature missing'
endif
func Test_profile_func()
diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim
index 1b8a1ec..5cf65d5 100644
--- a/src/testdir/test_prompt_buffer.vim
+++ b/src/testdir/test_prompt_buffer.vim
@@ -1,7 +1,7 @@
" Tests for setting 'buftype' to "prompt"
if !has('channel')
- finish
+ throw 'Skipped, channel feature missing'
endif
source shared.vim
diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim
index 5703231..5b10852 100644
--- a/src/testdir/test_python2.vim
+++ b/src/testdir/test_python2.vim
@@ -2,7 +2,7 @@
" TODO: move tests from test87.in here.
if !has('python')
- finish
+ throw 'Skipped, python feature missing'
endif
func Test_pydo()
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index aacc5a5..e001360 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -2,7 +2,7 @@
" TODO: move tests from test88.in here.
if !has('python3')
- finish
+ throw 'Skipped, python3 feature missing'
endif
func Test_py3do()
diff --git a/src/testdir/test_pyx2.vim b/src/testdir/test_pyx2.vim
index baaf7fa..64bd579 100644
--- a/src/testdir/test_pyx2.vim
+++ b/src/testdir/test_pyx2.vim
@@ -2,7 +2,7 @@
set pyx=2
if !has('python')
- finish
+ throw 'Skipped, python feature missing'
endif
let s:py2pattern = '^2\.[0-7]\.\d\+'
diff --git a/src/testdir/test_pyx3.vim b/src/testdir/test_pyx3.vim
index 4b6057a..1b7bdae 100644
--- a/src/testdir/test_pyx3.vim
+++ b/src/testdir/test_pyx3.vim
@@ -2,7 +2,7 @@
set pyx=3
if !has('python3')
- finish
+ throw 'Skipped, python3 feature missing'
endif
let s:py2pattern = '^2\.[0-7]\.\d\+'
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index ef0a512..2fa28c9 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1,7 +1,7 @@
" Test for the quickfix feature.
if !has('quickfix')
- finish
+ throw 'Skipped, quickfix feature missing'
endif
set encoding=utf-8
diff --git a/src/testdir/test_quotestar.vim b/src/testdir/test_quotestar.vim
index 1334201..b6dab6b 100644
--- a/src/testdir/test_quotestar.vim
+++ b/src/testdir/test_quotestar.vim
@@ -2,7 +2,7 @@
source shared.vim
if !WorkingClipboard()
- finish
+ throw 'Skipped, no working clipboard'
endif
source shared.vim
diff --git a/src/testdir/test_reltime.vim b/src/testdir/test_reltime.vim
index adabf16..1876539 100644
--- a/src/testdir/test_reltime.vim
+++ b/src/testdir/test_reltime.vim
@@ -1,7 +1,10 @@
" Tests for reltime()
-if !has('reltime') || !has('float')
- finish
+if !has('reltime')
+ throw 'Skipped, reltime feature missing'
+endif
+if !has('float')
+ throw 'Skipped, float feature missing'
endif
func Test_reltime()
diff --git a/src/testdir/test_ruby.vim b/src/testdir/test_ruby.vim
index 3c9df3a..dcfdc62 100644
--- a/src/testdir/test_ruby.vim
+++ b/src/testdir/test_ruby.vim
@@ -1,7 +1,7 @@
" Tests for ruby interface
if !has('ruby')
- finish
+ throw 'Skipped, ruby feature missing'
end
func Test_ruby_change_buffer()
diff --git a/src/testdir/test_sha256.vim b/src/testdir/test_sha256.vim
index dd47079..7f802b1 100644
--- a/src/testdir/test_sha256.vim
+++ b/src/testdir/test_sha256.vim
@@ -1,7 +1,10 @@
" Tests for the sha256() function.
-if !has('cryptv') || !exists('*sha256')
- finish
+if !has('cryptv')
+ throw 'Skipped, cryptv feature missing'
+endif
+if !exists('*sha256')
+ throw 'Skipped, sha256 function missing'
endif
function Test_sha256()
diff --git a/src/testdir/test_shortpathname.vim b/src/testdir/test_shortpathname.vim
index f151788..564cd96 100644
--- a/src/testdir/test_shortpathname.vim
+++ b/src/testdir/test_shortpathname.vim
@@ -2,7 +2,7 @@
" Only for use on Win32 systems!
if !has('win32')
- finish
+ throw 'Skipped, not on MS-Windows'
endif
func TestIt(file, bits, expected)
diff --git a/src/testdir/test_signals.vim b/src/testdir/test_signals.vim
index 5dec1d3..365958a 100644
--- a/src/testdir/test_signals.vim
+++ b/src/testdir/test_signals.vim
@@ -1,7 +1,7 @@
" Test signal handling.
if !has('unix')
- finish
+ throw 'Skipped, not on Unix'
endif
source shared.vim
diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim
index 8a6731c..4a23e4b 100644
--- a/src/testdir/test_signs.vim
+++ b/src/testdir/test_signs.vim
@@ -1,7 +1,7 @@
" Test for signs
if !has('signs')
- finish
+ throw 'Skipped, signs feature missing'
endif
func Test_sign()
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
index b3143c9..72599fd 100644
--- a/src/testdir/test_spell.vim
+++ b/src/testdir/test_spell.vim
@@ -1,7 +1,7 @@
" Test spell checking
if !has('spell')
- finish
+ throw 'Skipped, spell feature missing'
endif
func TearDown()
diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim
index bdcef51..8d9d7d3 100644
--- a/src/testdir/test_syntax.vim
+++ b/src/testdir/test_syntax.vim
@@ -1,7 +1,7 @@
" Test for syntax and syntax iskeyword option
if !has("syntax")
- finish
+ throw 'Skipped, syntax feature missing'
endif
source view_util.vim
diff --git a/src/testdir/test_tcl.vim b/src/testdir/test_tcl.vim
index c0eadc6..8ccd34c 100644
--- a/src/testdir/test_tcl.vim
+++ b/src/testdir/test_tcl.vim
@@ -1,7 +1,7 @@
" Tests for the Tcl interface.
if !has('tcl')
- finish
+ throw 'Skipped, tcl feature missing'
end
" Helper function as there is no builtin tcleval() function similar
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 9cfc649..9d7f6b5 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -1,8 +1,11 @@
" Tests for decoding escape sequences sent by the terminal.
" This only works for Unix in a terminal
-if has('gui_running') || !has('unix')
- finish
+if has('gui_running')
+ throw 'Skipped, does not work in the GUI'
+endif
+if !has('unix')
+ throw 'Skipped, not on Unix'
endif
source shared.vim
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 5fab975..09c050a 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1,7 +1,7 @@
" Tests for the terminal window.
if !has('terminal')
- finish
+ throw 'Skipped, terminal feature missing'
endif
source shared.vim
diff --git a/src/testdir/test_terminal_fail.vim b/src/testdir/test_terminal_fail.vim
index aad4b98..d010c3b 100644
--- a/src/testdir/test_terminal_fail.vim
+++ b/src/testdir/test_terminal_fail.vim
@@ -3,7 +3,7 @@
" freed. Since the process exists right away it's not a real leak.
if !has('terminal')
- finish
+ throw 'Skipped, terminal feature missing'
endif
source shared.vim
diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim
index 0baabc0..5366a35 100644
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -1,7 +1,7 @@
" Test for textobjects
if !has('textobjects')
- finish
+ throw 'Skipped, textobjects feature missing'
endif
func CpoM(line, useM, expected)
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index bfd39d5..cb27f58 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2,7 +2,7 @@
" buffer.
if !has('textprop')
- finish
+ throw 'Skipped, textprop feature missing'
endif
source screendump.vim
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index 963cc23..5b09011 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -1,7 +1,7 @@
" Test for timers
if !has('timers')
- finish
+ throw 'Skipped, timers feature missing'
endif
source shared.vim
diff --git a/src/testdir/test_vartabs.vim b/src/testdir/test_vartabs.vim
index df61c0e..640aa0b 100644
--- a/src/testdir/test_vartabs.vim
+++ b/src/testdir/test_vartabs.vim
@@ -1,7 +1,7 @@
" Test for variable tabstops
if !has("vartabs")
- finish
+ throw 'Skipped, vartabs feature missing'
endif
source view_util.vim
diff --git a/src/testdir/test_winbar.vim b/src/testdir/test_winbar.vim
index c0b43b9..51ef0a8 100644
--- a/src/testdir/test_winbar.vim
+++ b/src/testdir/test_winbar.vim
@@ -1,7 +1,7 @@
" Test WinBar
if !has('menu')
- finish
+ throw 'Skipped, menu feature missing'
endif
source shared.vim
diff --git a/src/testdir/test_windows_home.vim b/src/testdir/test_windows_home.vim
index 2e311b9..da95ed2 100644
--- a/src/testdir/test_windows_home.vim
+++ b/src/testdir/test_windows_home.vim
@@ -1,7 +1,7 @@
" Test for $HOME on Windows.
if !has('win32')
- finish
+ throw 'Skipped, not on MS-Windows'
endif
let s:env = {}
diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index 6b9dd54..63ac574 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -2,7 +2,7 @@
if empty($XXD) && executable('..\xxd\xxd.exe')
let s:xxd_cmd = '..\xxd\xxd.exe'
elseif empty($XXD) || !executable($XXD)
- finish
+ throw 'Skipped, xxd program missing'
else
let s:xxd_cmd = $XXD
endif