Bram Moolenaar | b46fecd | 2019-06-15 17:58:09 +0200 | [diff] [blame] | 1 | " Command to check for the presence of a feature. |
| 2 | command -nargs=1 CheckFeature call CheckFeature(<f-args>) |
| 3 | func CheckFeature(name) |
| 4 | if !has(a:name) |
| 5 | throw 'Skipped: ' .. a:name .. ' feature missing' |
| 6 | endif |
| 7 | endfunc |
| 8 | |
| 9 | " Command to check for the presence of a working option. |
| 10 | command -nargs=1 CheckOption call CheckOption(<f-args>) |
| 11 | func CheckOption(name) |
| 12 | if !exists('+' .. a:name) |
| 13 | throw 'Skipped: ' .. a:name .. ' option not supported' |
| 14 | endif |
| 15 | endfunc |
| 16 | |
| 17 | " Command to check for the presence of a function. |
| 18 | command -nargs=1 CheckFunction call CheckFunction(<f-args>) |
| 19 | func CheckFunction(name) |
| 20 | if !exists('*' .. a:name) |
| 21 | throw 'Skipped: ' .. a:name .. ' function missing' |
| 22 | endif |
| 23 | endfunc |
Bram Moolenaar | 4641a12 | 2019-07-29 22:10:23 +0200 | [diff] [blame] | 24 | |
| 25 | " Command to check for running on MS-Windows |
| 26 | command CheckMSWindows call CheckMSWindows() |
| 27 | func CheckMSWindows() |
| 28 | if !has('win32') |
| 29 | throw 'Skipped: only works on MS-Windows' |
| 30 | endif |
| 31 | endfunc |
| 32 | |
| 33 | " Command to check for running on Unix |
| 34 | command CheckUnix call CheckUnix() |
| 35 | func CheckUnix() |
| 36 | if !has('unix') |
| 37 | throw 'Skipped: only works on Unix' |
| 38 | endif |
| 39 | endfunc |
Bram Moolenaar | 3c8ee62 | 2019-08-03 22:55:50 +0200 | [diff] [blame] | 40 | |
| 41 | " Command to check that making screendumps is supported. |
| 42 | " Caller must source screendump.vim |
| 43 | command CheckScreendump call CheckScreendump() |
| 44 | func CheckScreendump() |
| 45 | if !CanRunVimInTerminal() |
| 46 | throw 'Skipped: cannot make screendumps' |
| 47 | endif |
| 48 | endfunc |
| 49 | |
| 50 | " Command to check that we can Run Vim in a terminal window |
| 51 | command CheckRunVimInTerminal call CheckRunVimInTerminal() |
| 52 | func CheckRunVimInTerminal() |
| 53 | if !CanRunVimInTerminal() |
| 54 | throw 'Skipped: cannot run Vim in a terminal window' |
| 55 | endif |
| 56 | endfunc |