diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-07 23:07:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-07 23:07:07 +0200 |
commit | 8c5a278fc508da6dfe50e69b6ee734451aa4eafb (patch) | |
tree | 8a07c54e9ea8667a88f4aa2566e3c3c314727751 /src/testdir/check.vim | |
parent | b59e7357722d977830948572a395f0a175c7ded8 (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.
Diffstat (limited to 'src/testdir/check.vim')
-rw-r--r-- | src/testdir/check.vim | 48 |
1 files changed, 48 insertions, 0 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 |