summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-07 23:07:07 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-07 23:07:07 +0200
commit8c5a278fc508da6dfe50e69b6ee734451aa4eafb (patch)
tree8a07c54e9ea8667a88f4aa2566e3c3c314727751
parentb59e7357722d977830948572a395f0a175c7ded8 (diff)
patch 8.1.1826: tests use hand coded feature and option checksv8.1.1826
Problem: Tests use hand coded feature and option checks. Solution: Use the commands from check.vim in more tests.
-rw-r--r--src/testdir/check.vim48
-rw-r--r--src/testdir/shared.vim4
-rw-r--r--src/testdir/test_autochdir.vim5
-rw-r--r--src/testdir/test_autocmd.vim7
-rw-r--r--src/testdir/test_balloon.vim9
-rw-r--r--src/testdir/test_breakindent.vim5
-rw-r--r--src/testdir/test_bufline.vim6
-rw-r--r--src/testdir/test_cdo.vim5
-rw-r--r--src/testdir/test_channel.vim24
-rw-r--r--src/testdir/test_clientserver.vim6
-rw-r--r--src/testdir/test_conceal.vim9
-rw-r--r--src/testdir/test_cscope.vim5
-rw-r--r--src/testdir/test_debugger.vim5
-rw-r--r--src/testdir/test_filechanged.vim12
-rw-r--r--src/testdir/test_fold.vim5
-rw-r--r--src/testdir/test_functions.vim6
-rw-r--r--src/testdir/test_gui.vim5
-rw-r--r--src/testdir/test_gui_init.vim5
-rw-r--r--src/testdir/test_highlight.vim13
-rw-r--r--src/testdir/test_mapping.vim5
-rw-r--r--src/testdir/test_match.vim6
-rw-r--r--src/testdir/test_memory_usage.vim4
-rw-r--r--src/testdir/test_options.vim64
-rw-r--r--src/testdir/test_paste.vim10
-rw-r--r--src/testdir/test_popup.vim13
-rw-r--r--src/testdir/test_search.vim15
-rw-r--r--src/testdir/test_signals.vim10
-rw-r--r--src/testdir/test_startup.vim36
-rw-r--r--src/testdir/test_syntax.vim5
-rw-r--r--src/testdir/test_termcodes.vim9
-rw-r--r--src/testdir/test_terminal.vim8
-rw-r--r--src/testdir/test_timers.vim9
-rw-r--r--src/testdir/test_vimscript.vim7
-rw-r--r--src/version.c2
34 files changed, 198 insertions, 189 deletions
diff --git a/src/testdir/check.vim b/src/testdir/check.vim
index 5d61f0dbaf..4381c4ed8f 100644
--- a/src/testdir/check.vim
+++ b/src/testdir/check.vim
@@ -22,6 +22,22 @@ func CheckFunction(name)
endif
endfunc
+" Command to check for the presence of an Ex command
+command -nargs=1 CheckCommand call CheckCommand(<f-args>)
+func CheckCommand(name)
+ if !exists(':' .. a:name)
+ throw 'Skipped: ' .. a:name .. ' command not supported'
+ endif
+endfunc
+
+" Command to check for the presence of a shell command
+command -nargs=1 CheckExecutable call CheckExecutable(<f-args>)
+func CheckExecutable(name)
+ if !executable(a:name)
+ throw 'Skipped: ' .. a:name .. ' program not executable'
+ endif
+endfunc
+
" Command to check for running on MS-Windows
command CheckMSWindows call CheckMSWindows()
func CheckMSWindows()
@@ -30,6 +46,14 @@ func CheckMSWindows()
endif
endfunc
+" Command to check for NOT running on MS-Windows
+command CheckNotMSWindows call CheckNotMSWindows()
+func CheckNotMSWindows()
+ if has('win32')
+ throw 'Skipped: does not work on MS-Windows'
+ endif
+endfunc
+
" Command to check for running on Unix
command CheckUnix call CheckUnix()
func CheckUnix()
@@ -54,3 +78,27 @@ func CheckRunVimInTerminal()
throw 'Skipped: cannot run Vim in a terminal window'
endif
endfunc
+
+" Command to check that we can run the GUI
+command CheckCanRunGui call CheckCanRunGui()
+func CheckCanRunGui()
+ if !has('gui') || ($DISPLAY == "" && !has('gui_running'))
+ throw 'Skipped: cannot run start the GUI'
+ endif
+endfunc
+
+" Command to check that we are using the GUI
+command CheckGui call CheckGui()
+func CheckGui()
+ if !has('gui_running')
+ throw 'Skipped: only works in the GUI'
+ endif
+endfunc
+
+" Command to check that not currently using the GUI
+command CheckNotGui call CheckNotGui()
+func CheckNotGui()
+ if has('gui_running')
+ throw 'Skipped: only works in the terminal'
+ endif
+endfunc
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 9e4b1bb012..54a37f309f 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -323,10 +323,6 @@ func RunVimPiped(before, after, arguments, pipecmd)
return 1
endfunc
-func CanRunGui()
- return has('gui') && ($DISPLAY != "" || has('gui_running'))
-endfunc
-
func WorkingClipboard()
if !has('clipboard')
return 0
diff --git a/src/testdir/test_autochdir.vim b/src/testdir/test_autochdir.vim
index 1f99858efb..98d1af74fd 100644
--- a/src/testdir/test_autochdir.vim
+++ b/src/testdir/test_autochdir.vim
@@ -1,8 +1,7 @@
" Test 'autochdir' behavior
-if !exists("+autochdir")
- throw 'Skipped: autochdir feature missing'
-endif
+source check.vim
+CheckOption autochdir
func Test_set_filename()
let cwd = getcwd()
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index d762c91948..5bb601e2d7 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -1,6 +1,7 @@
" Tests for autocommands
source shared.vim
+source check.vim
func s:cleanup_buffers() abort
for bnr in range(1, bufnr('$'))
@@ -1861,9 +1862,9 @@ func Test_TextChangedI_with_setline()
endfunc
func Test_Changed_FirstTime()
- if !has('terminal') || has('gui_running')
- return
- endif
+ CheckFeature terminal
+ CheckNotGui
+
" Prepare file for TextChanged event.
call writefile([''], 'Xchanged.txt')
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim
index 796cb23f67..e4ee855a7d 100644
--- a/src/testdir/test_balloon.vim
+++ b/src/testdir/test_balloon.vim
@@ -1,17 +1,12 @@
" Tests for 'balloonevalterm'.
" A few tests only work in the terminal.
-if has('gui_running')
- throw 'Skipped: only work in the terminal'
-endif
-
source check.vim
+CheckNotGui
CheckFeature balloon_eval_term
source screendump.vim
-if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
-endif
+CheckScreendump
let s:common_script =<< trim [CODE]
call setline(1, ["one one one", "two tXo two", "three three three"])
diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim
index 1dd5aa6b03..5b8971e7ec 100644
--- a/src/testdir/test_breakindent.vim
+++ b/src/testdir/test_breakindent.vim
@@ -4,9 +4,8 @@
" while the test is run, the breakindent cacheing gets in its way.
" It helps to change the tabstop setting and force a redraw (e.g. see
" Test_breakindent08())
-if !exists('+breakindent')
- throw 'Skipped: breakindent option not supported'
-endif
+source check.vim
+CheckOption breakindent
source view_util.vim
diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim
index eb46104a89..a6b4694b83 100644
--- a/src/testdir/test_bufline.vim
+++ b/src/testdir/test_bufline.vim
@@ -2,6 +2,7 @@
source shared.vim
source screendump.vim
+source check.vim
func Test_setbufline_getbufline()
new
@@ -147,9 +148,8 @@ func Test_deletebufline()
endfunc
func Test_appendbufline_redraw()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
+
let lines =<< trim END
new foo
let winnr=bufwinnr('foo')
diff --git a/src/testdir/test_cdo.vim b/src/testdir/test_cdo.vim
index aa2e4f1a8c..8a6b746718 100644
--- a/src/testdir/test_cdo.vim
+++ b/src/testdir/test_cdo.vim
@@ -1,8 +1,7 @@
" Tests for the :cdo, :cfdo, :ldo and :lfdo commands
-if !has('quickfix')
- throw 'Skipped: quickfix feature missing'
-endif
+source check.vim
+CheckFeature quickfix
" Create the files used by the tests
function SetUp()
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 5a4234cec9..dd19894e28 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -855,9 +855,8 @@ func Test_pipe_from_buffer_nr()
endfunc
func Run_pipe_through_sort(all, use_buffer)
- if !executable('sort')
- throw 'Skipped: sort program not found'
- endif
+ CheckExecutable sort
+
let options = {'out_io': 'buffer', 'out_name': 'sortout'}
if a:use_buffer
split sortin
@@ -1014,9 +1013,8 @@ func Test_pipe_io_one_buffer()
endfunc
func Test_write_to_buffer_and_scroll()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
+
let lines =<< trim END
new Xscrollbuffer
call setline(1, range(1, 200))
@@ -1536,9 +1534,8 @@ func Test_using_freed_memory()
endfunc
func Test_collapse_buffers()
- if !executable('cat')
- throw 'Skipped: cat program not found'
- endif
+ CheckExecutable cat
+
sp test_channel.vim
let g:linecount = line('$')
close
@@ -1550,9 +1547,8 @@ func Test_collapse_buffers()
endfunc
func Test_write_to_deleted_buffer()
- if !executable('echo')
- throw 'Skipped: echo program not found'
- endif
+ CheckExecutable echo
+
let job = job_start('echo hello', {'out_io': 'buffer', 'out_name': 'test_buffer', 'out_msg': 0})
let bufnr = bufnr('test_buffer')
call WaitForAssert({-> assert_equal(['hello'], getbufline(bufnr, 1, '$'))})
@@ -1585,9 +1581,7 @@ func Test_cmd_parsing()
endfunc
func Test_raw_passes_nul()
- if !executable('cat')
- throw 'Skipped: cat program not found'
- endif
+ CheckExecutable cat
" Test lines from the job containing NUL are stored correctly in a buffer.
new
diff --git a/src/testdir/test_clientserver.vim b/src/testdir/test_clientserver.vim
index 3377f86126..385ff91296 100644
--- a/src/testdir/test_clientserver.vim
+++ b/src/testdir/test_clientserver.vim
@@ -1,8 +1,8 @@
" Tests for the +clientserver feature.
-if !has('job') || !has('clientserver')
- throw 'Skipped: job and/or clientserver feature missing'
-endif
+source check.vim
+CheckFeature job
+CheckFeature clientserver
source shared.vim
diff --git a/src/testdir/test_conceal.vim b/src/testdir/test_conceal.vim
index f114651c21..6b9524263d 100644
--- a/src/testdir/test_conceal.vim
+++ b/src/testdir/test_conceal.vim
@@ -1,14 +1,11 @@
" Tests for 'conceal'.
" Also see test88.in (should be converted to a test function here).
-if !has('conceal')
- throw 'Skipped: conceal feature missing'
-endif
+source check.vim
+CheckFeature conceal
source screendump.vim
-if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
-endif
+CheckScreendump
func Test_conceal_two_windows()
let code =<< trim [CODE]
diff --git a/src/testdir/test_cscope.vim b/src/testdir/test_cscope.vim
index c776be1138..9d69da95dd 100644
--- a/src/testdir/test_cscope.vim
+++ b/src/testdir/test_cscope.vim
@@ -3,10 +3,7 @@
source check.vim
CheckFeature cscope
CheckFeature quickfix
-
-if !executable('cscope')
- throw 'Skipped: cscope program missing'
-endif
+CheckExecutable cscope
func CscopeSetupOrClean(setup)
if a:setup
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 811717208e..861bd6fc08 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -2,6 +2,7 @@
source shared.vim
source screendump.vim
+source check.vim
" Run a Vim debugger command
" If the expected output argument is supplied, then check for it.
@@ -21,9 +22,7 @@ endfunc
" Debugger tests
func Test_Debugger()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot run Vim in a terminal window'
- endif
+ CheckRunVimInTerminal
" Create a Vim script with some functions
let lines =<< trim END
diff --git a/src/testdir/test_filechanged.vim b/src/testdir/test_filechanged.vim
index a937bb8d10..bfcdb76abb 100644
--- a/src/testdir/test_filechanged.vim
+++ b/src/testdir/test_filechanged.vim
@@ -1,9 +1,10 @@
" Tests for when a file was changed outside of Vim.
+source check.vim
+
func Test_FileChangedShell_reload()
- if !has('unix')
- return
- endif
+ CheckUnix
+
augroup testreload
au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'reload'
augroup END
@@ -91,9 +92,8 @@ func Test_FileChangedShell_reload()
endfunc
func Test_file_changed_dialog()
- if !has('unix') || has('gui_running')
- return
- endif
+ CheckUnix
+ CheckNotGui
au! FileChangedShell
new Xchanged_d
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index ed87007c19..dc5879516c 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -1,5 +1,6 @@
" Test for folding
+source check.vim
source view_util.vim
source screendump.vim
@@ -707,9 +708,7 @@ func Test_fold_last_line_with_pagedown()
endfunc
func Test_folds_with_rnu()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
call writefile([
\ 'set fdm=marker rnu foldcolumn=2',
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 1833113b81..474e6384e8 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1,5 +1,6 @@
" Tests for various functions.
source shared.vim
+source check.vim
" Must be done first, since the alternate buffer must be unset.
func Test_00_bufexists()
@@ -1376,9 +1377,8 @@ endfunc
" Test confirm({msg} [, {choices} [, {default} [, {type}]]])
func Test_confirm()
- if !has('unix') || has('gui_running')
- return
- endif
+ CheckUnix
+ CheckNotGui
call feedkeys('o', 'L')
let a = confirm('Press O to proceed')
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim
index 97fd12b2b2..985bbf4b71 100644
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -1,9 +1,8 @@
" Tests specifically for the GUI
source shared.vim
-if !CanRunGui()
- throw 'Skipped: cannot run GUI'
-endif
+source check.vim
+CheckCanRunGui
source setup_gui.vim
diff --git a/src/testdir/test_gui_init.vim b/src/testdir/test_gui_init.vim
index ecc8fc9efe..a18825565d 100644
--- a/src/testdir/test_gui_init.vim
+++ b/src/testdir/test_gui_init.vim
@@ -2,9 +2,8 @@
" startup to take effect at runtime.
source shared.vim
-if !CanRunGui()
- throw 'Skipped: cannot run GUI'
-endif
+source check.vim
+CheckCanRunGui
source setup_gui.vim
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim
index 2499543434..3d640bbe83 100644
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -2,6 +2,7 @@
source view_util.vim
source screendump.vim
+source check.vim
func Test_highlight()
" basic test if ":highlight" doesn't crash
@@ -532,9 +533,7 @@ func Test_termguicolors()
endfunc
func Test_cursorline_after_yank()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
call writefile([
\ 'set cul rnu',
@@ -554,9 +553,7 @@ func Test_cursorline_after_yank()
endfunc
func Test_cursorline_with_visualmode()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
call writefile([
\ 'set cul',
@@ -574,9 +571,7 @@ func Test_cursorline_with_visualmode()
endfunc
func Test_wincolor()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
let lines =<< trim END
set cursorline cursorcolumn rnu
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim
index 2c6aa24976..71548edda0 100644
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -1,6 +1,7 @@
" Tests for mappings and abbreviations
source shared.vim
+source check.vim
func Test_abbreviation()
" abbreviation with 0x80 should work
@@ -399,7 +400,9 @@ func Test_motionforce_omap()
endfunc
func Test_error_in_map_expr()
- if !has('terminal') || (has('win32') && has('gui_running'))
+ " Unlike CheckRunVimInTerminal this does work in a win32 console
+ CheckFeature terminal
+ if has('win32') && has('gui_running')
throw 'Skipped: cannot run Vim in a terminal window'
endif
diff --git a/src/testdir/test_match.vim b/src/testdir/test_match.vim
index 8eada3fea5..db87914f82 100644
--- a/src/testdir/test_match.vim
+++ b/src/testdir/test_match.vim
@@ -2,6 +2,7 @@
" matchaddpos(), matcharg(), matchdelete(), and setmatches().
source screendump.vim
+source check.vim
function Test_match()
highlight MyGroup1 term=bold ctermbg=red guibg=red
@@ -267,9 +268,8 @@ func OtherWindowCommon()
endfunc
func Test_matchdelete_other_window()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
+
let buf = OtherWindowCommon()
call term_sendkeys(buf, ":call matchdelete(mid, winid)\<CR>")
call VerifyScreenDump(buf, 'Test_matchdelete_1', {})
diff --git a/src/testdir/test_memory_usage.vim b/src/testdir/test_memory_usage.vim
index debc9c1859..d7c7036ffa 100644
--- a/src/testdir/test_memory_usage.vim
+++ b/src/testdir/test_memory_usage.vim
@@ -2,10 +2,8 @@
source check.vim
CheckFeature terminal
+CheckNotGui
-if has('gui_running')
- throw 'Skipped: does not work in GUI'
-endif
if execute('version') =~# '-fsanitize=[a-z,]*\<address\>'
" Skip tests on Travis CI ASAN build because it's difficult to estimate
" memory usage.
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index cbe00840cb..5d5723cca6 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -1,5 +1,7 @@
" Test for options
+source check.vim
+
func Test_whichwrap()
set whichwrap=b,s
call assert_equal('b,s', &whichwrap)
@@ -296,9 +298,8 @@ endfunc
" Must be executed before other tests that set 'term'.
func Test_000_term_option_verbose()
- if has('gui_running')
- return
- endif
+ CheckNotGui
+
let verb_cm = execute('verbose set t_cm')
call assert_notmatch('Last set from', verb_cm)
@@ -310,34 +311,35 @@ func Test_000_term_option_verbose()
endfunc
func Test_set_ttytype()
- if !has('gui_running') && has('unix')
- " Setting 'ttytype' used to cause a double-free when exiting vim and
- " when vim is compiled with -DEXITFREE.
- set ttytype=ansi
- call assert_equal('ansi', &ttytype)
- call assert_equal(&ttytype, &term)
- set ttytype=xterm
- call assert_equal('xterm', &ttytype)
- call assert_equal(&ttytype, &term)
- " "set ttytype=" gives E522 instead of E529
- " in travis on some builds. Why? Catch both for now
- try
- set ttytype=
- call assert_report('set ttytype= did not fail')
- catch /E529\|E522/
- endtry
-
- " Some systems accept any terminal name and return dumb settings,
- " check for failure of finding the entry and for missing 'cm' entry.
- try
- set ttytype=xxx
- call assert_report('set ttytype=xxx did not fail')
- catch /E522\|E437/
- endtry
-
- set ttytype&
- call assert_equal(&ttytype, &term)
- endif
+ CheckUnix
+ CheckNotGui
+
+ " Setting 'ttytype' used to cause a double-free when exiting vim and
+ " when vim is compiled with -DEXITFREE.
+ set ttytype=ansi
+ call assert_equal('ansi', &ttytype)
+ call assert_equal(&ttytype, &term)
+ set ttytype=xterm
+ call assert_equal('xterm', &ttytype)
+ call assert_equal(&ttytype, &term)
+ " "set ttytype=" gives E522 instead of E529
+ " in travis on some builds. Why? Catch both for now
+ try
+ set ttytype=
+ call assert_report('set ttytype= did not fail')
+ catch /E529\|E522/
+ endtry
+
+ " Some systems accept any terminal name and return dumb settings,
+ " check for failure of finding the entry and for missing 'cm' entry.
+ try
+ set ttytype=xxx
+ call assert_report('set ttytype=xxx did not fail')
+ catch /E522\|E437/
+ endtry
+
+ set ttytype&
+ call assert_equal(&ttytype, &term)
endfunc
func Test_set_all()
diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim
index a22e8e505e..eab4cff537 100644
--- a/src/testdir/test_paste.vim
+++ b/src/testdir/test_paste.vim
@@ -1,12 +1,10 @@
" Tests for bracketed paste and other forms of pasting.
" Bracketed paste only works with "xterm". Not in GUI or Windows console.
-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
+source check.vim
+CheckNotMSWindows
+CheckNotGui
+
set term=xterm
source shared.vim
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index b25108c4e1..e7b4c7246d 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -2,6 +2,7 @@
source shared.vim
source screendump.vim
+source check.vim
let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
let g:setting = ''
@@ -663,9 +664,9 @@ func Test_complete_CTRLN_startofbuffer()
endfunc
func Test_popup_and_window_resize()
- if !has('terminal') || has('gui_running')
- return
- endif
+ CheckFeature terminal
+ CheckNotGui
+
let h = winheight(0)
if h < 15
return
@@ -918,9 +919,9 @@ func Test_complete_o_tab()
endfunc
func Test_menu_only_exists_in_terminal()
- if !exists(':tlmenu') || has('gui_running')
- return
- endif
+ CheckCommand tlmenu
+ CheckNotGui
+
tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+
aunmenu *
try
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index a356393b06..604f3c2ed9 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -2,6 +2,7 @@
source shared.vim
source screendump.vim
+source check.vim
func Test_search_cmdline()
if !exists('+incsearch')
@@ -575,12 +576,13 @@ endfunc
func Test_search_cmdline8()
" Highlighting is cleared in all windows
" since hls applies to all windows
- if !exists('+incsearch') || !has('terminal') || has('gui_running') || winwidth(0) < 30
- return
- endif
+ CheckOption incsearch
+ CheckFeature terminal
+ CheckNotGui
if has("win32")
throw "Skipped: Bug with sending <ESC> to terminal window not fixed yet"
endif
+
let h = winheight(0)
if h < 3
return
@@ -702,9 +704,10 @@ func Test_search_cmdline_incsearch_highlight()
endfunc
func Test_search_cmdline_incsearch_highlight_attr()
- if !exists('+incsearch') || !has('terminal') || has('gui_running')
- return
- endif
+ CheckOption incsearch
+ CheckFeature terminal
+ CheckNotGui
+
let h = winheight(0)
if h < 3
return
diff --git a/src/testdir/test_signals.vim b/src/testdir/test_signals.vim
index 44732df88d..cc1c3fb502 100644
--- a/src/testdir/test_signals.vim
+++ b/src/testdir/test_signals.vim
@@ -1,8 +1,7 @@
" Test signal handling.
-if !has('unix')
- throw 'Skipped: not on Unix'
-endif
+source check.vim
+CheckUnix
source shared.vim
@@ -14,8 +13,9 @@ endfunc
" Test signal WINCH (window resize signal)
func Test_signal_WINCH()
- if has('gui_running') || !HasSignal('WINCH')
- return
+ CheckNotGui
+ if !HasSignal('WINCH')
+ throw 'Skipped: WINCH signal not supported'
endif
" We do not actually want to change the size of the terminal.
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 6b678fb20b..ceee044ca3 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -2,6 +2,7 @@
source shared.vim
source screendump.vim
+source check.vim
" Check that loading startup.vim works.
func Test_startup_script()
@@ -262,10 +263,9 @@ endfunc
" Test the -V[N] argument to set the 'verbose' option to [N]
func Test_V_arg()
- if has('gui_running')
- " Can't catch the output of gvim.
- return
- endif
+ " Can't catch the output of gvim.
+ CheckNotGui
+
let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
call assert_equal(" verbose=0\n", out)
@@ -395,10 +395,9 @@ func Test_A_F_H_arg()
endfunc
func Test_invalid_args()
- if !has('unix') || has('gui_running')
- " can't get output of Vim.
- return
- endif
+ " must be able to get the output of Vim.
+ CheckUnix
+ CheckNotGui
for opt in ['-Y', '--does-not-exist']
let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
@@ -599,10 +598,9 @@ func Test_progpath()
endfunc
func Test_silent_ex_mode()
- if !has('unix') || has('gui_running')
- " can't get output of Vim.
- return
- endif
+ " must be able to get the output of Vim.
+ CheckUnix
+ CheckNotGui
" This caused an ml_get error.
let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq')
@@ -610,10 +608,9 @@ func Test_silent_ex_mode()
endfunc
func Test_default_term()
- if !has('unix') || has('gui_running')
- " can't get output of Vim.
- return
- endif
+ " must be able to get the output of Vim.
+ CheckUnix
+ CheckNotGui
let save_term = $TERM
let $TERM = 'unknownxxx'
@@ -649,10 +646,9 @@ func Test_zzz_startinsert()
endfunc
func Test_issue_3969()
- if has('gui_running')
- " Can't catch the output of gvim.
- return
- endif
+ " Can't catch the output of gvim.
+ CheckNotGui
+
" Check that message is not truncated.
let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq')
cal