diff options
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 5d61f0dba..4381c4ed8 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 |