blob: 4381c4ed8f686c1a0a154b622da6b383db3bb4fa [file] [log] [blame]
Bram Moolenaarb46fecd2019-06-15 17:58:09 +02001" Command to check for the presence of a feature.
2command -nargs=1 CheckFeature call CheckFeature(<f-args>)
3func CheckFeature(name)
4 if !has(a:name)
5 throw 'Skipped: ' .. a:name .. ' feature missing'
6 endif
7endfunc
8
9" Command to check for the presence of a working option.
10command -nargs=1 CheckOption call CheckOption(<f-args>)
11func CheckOption(name)
12 if !exists('+' .. a:name)
13 throw 'Skipped: ' .. a:name .. ' option not supported'
14 endif
15endfunc
16
17" Command to check for the presence of a function.
18command -nargs=1 CheckFunction call CheckFunction(<f-args>)
19func CheckFunction(name)
20 if !exists('*' .. a:name)
21 throw 'Skipped: ' .. a:name .. ' function missing'
22 endif
23endfunc
Bram Moolenaar4641a122019-07-29 22:10:23 +020024
Bram Moolenaar8c5a2782019-08-07 23:07:07 +020025" Command to check for the presence of an Ex command
26command -nargs=1 CheckCommand call CheckCommand(<f-args>)
27func CheckCommand(name)
28 if !exists(':' .. a:name)
29 throw 'Skipped: ' .. a:name .. ' command not supported'
30 endif
31endfunc
32
33" Command to check for the presence of a shell command
34command -nargs=1 CheckExecutable call CheckExecutable(<f-args>)
35func CheckExecutable(name)
36 if !executable(a:name)
37 throw 'Skipped: ' .. a:name .. ' program not executable'
38 endif
39endfunc
40
Bram Moolenaar4641a122019-07-29 22:10:23 +020041" Command to check for running on MS-Windows
42command CheckMSWindows call CheckMSWindows()
43func CheckMSWindows()
44 if !has('win32')
45 throw 'Skipped: only works on MS-Windows'
46 endif
47endfunc
48
Bram Moolenaar8c5a2782019-08-07 23:07:07 +020049" Command to check for NOT running on MS-Windows
50command CheckNotMSWindows call CheckNotMSWindows()
51func CheckNotMSWindows()
52 if has('win32')
53 throw 'Skipped: does not work on MS-Windows'
54 endif
55endfunc
56
Bram Moolenaar4641a122019-07-29 22:10:23 +020057" Command to check for running on Unix
58command CheckUnix call CheckUnix()
59func CheckUnix()
60 if !has('unix')
61 throw 'Skipped: only works on Unix'
62 endif
63endfunc
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020064
65" Command to check that making screendumps is supported.
66" Caller must source screendump.vim
67command CheckScreendump call CheckScreendump()
68func CheckScreendump()
69 if !CanRunVimInTerminal()
70 throw 'Skipped: cannot make screendumps'
71 endif
72endfunc
73
74" Command to check that we can Run Vim in a terminal window
75command CheckRunVimInTerminal call CheckRunVimInTerminal()
76func CheckRunVimInTerminal()
77 if !CanRunVimInTerminal()
78 throw 'Skipped: cannot run Vim in a terminal window'
79 endif
80endfunc
Bram Moolenaar8c5a2782019-08-07 23:07:07 +020081
82" Command to check that we can run the GUI
83command CheckCanRunGui call CheckCanRunGui()
84func CheckCanRunGui()
85 if !has('gui') || ($DISPLAY == "" && !has('gui_running'))
86 throw 'Skipped: cannot run start the GUI'
87 endif
88endfunc
89
90" Command to check that we are using the GUI
91command CheckGui call CheckGui()
92func CheckGui()
93 if !has('gui_running')
94 throw 'Skipped: only works in the GUI'
95 endif
96endfunc
97
98" Command to check that not currently using the GUI
99command CheckNotGui call CheckNotGui()
100func CheckNotGui()
101 if has('gui_running')
102 throw 'Skipped: only works in the terminal'
103 endif
104endfunc