Mercurial > vim
annotate src/testdir/check.vim @ 18678:cb4a4b71df4a
Added tag v8.1.2330 for changeset 953e83e09e7847b87f1538e82e505b37ae73af1b
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 21 Nov 2019 21:00:05 +0100 |
parents | f6dcf7eabd26 |
children | 97d534e17874 |
rev | line source |
---|---|
18277
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
1 source shared.vim |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 " Command to check for the presence of a feature. |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 command -nargs=1 CheckFeature call CheckFeature(<f-args>) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 func CheckFeature(name) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 if !has(a:name) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 throw 'Skipped: ' .. a:name .. ' feature missing' |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 endif |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 endfunc |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 " Command to check for the presence of a working option. |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 command -nargs=1 CheckOption call CheckOption(<f-args>) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 func CheckOption(name) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 if !exists('+' .. a:name) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 throw 'Skipped: ' .. a:name .. ' option not supported' |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 endif |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 endfunc |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 " Command to check for the presence of a function. |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 command -nargs=1 CheckFunction call CheckFunction(<f-args>) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 func CheckFunction(name) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 if !exists('*' .. a:name) |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 throw 'Skipped: ' .. a:name .. ' function missing' |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 endif |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 endfunc |
17557
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
26 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
27 " Command to check for the presence of an Ex command |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
28 command -nargs=1 CheckCommand call CheckCommand(<f-args>) |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
29 func CheckCommand(name) |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
30 if !exists(':' .. a:name) |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
31 throw 'Skipped: ' .. a:name .. ' command not supported' |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
32 endif |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
33 endfunc |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
34 |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
35 " Command to check for the presence of a shell command |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
36 command -nargs=1 CheckExecutable call CheckExecutable(<f-args>) |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
37 func CheckExecutable(name) |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
38 if !executable(a:name) |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
39 throw 'Skipped: ' .. a:name .. ' program not executable' |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
40 endif |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
41 endfunc |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
42 |
17557
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
43 " Command to check for running on MS-Windows |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
44 command CheckMSWindows call CheckMSWindows() |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
45 func CheckMSWindows() |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
46 if !has('win32') |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
47 throw 'Skipped: only works on MS-Windows' |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
48 endif |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
49 endfunc |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
50 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
51 " Command to check for NOT running on MS-Windows |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
52 command CheckNotMSWindows call CheckNotMSWindows() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
53 func CheckNotMSWindows() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
54 if has('win32') |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
55 throw 'Skipped: does not work on MS-Windows' |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
56 endif |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
57 endfunc |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
58 |
17557
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
59 " Command to check for running on Unix |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
60 command CheckUnix call CheckUnix() |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
61 func CheckUnix() |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
62 if !has('unix') |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
63 throw 'Skipped: only works on Unix' |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
64 endif |
4a22102fda8f
patch 8.1.1776: text added with a job isn't displayed
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
65 endfunc |
17614
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
66 |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
67 " Command to check that making screendumps is supported. |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
68 " Caller must source screendump.vim |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
69 command CheckScreendump call CheckScreendump() |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
70 func CheckScreendump() |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
71 if !CanRunVimInTerminal() |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
72 throw 'Skipped: cannot make screendumps' |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
73 endif |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
74 endfunc |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
75 |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
76 " Command to check that we can Run Vim in a terminal window |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
77 command CheckRunVimInTerminal call CheckRunVimInTerminal() |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
78 func CheckRunVimInTerminal() |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
79 if !CanRunVimInTerminal() |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
80 throw 'Skipped: cannot run Vim in a terminal window' |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
81 endif |
d7708560b77c
patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents:
17557
diff
changeset
|
82 endfunc |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
83 |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
84 " Command to check that we can run the GUI |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
85 command CheckCanRunGui call CheckCanRunGui() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
86 func CheckCanRunGui() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
87 if !has('gui') || ($DISPLAY == "" && !has('gui_running')) |
17668
923154c51bef
patch 8.1.1831: confusing skipped message
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
88 throw 'Skipped: cannot start the GUI' |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
89 endif |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
90 endfunc |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
91 |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
92 " Command to check that we are using the GUI |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
93 command CheckGui call CheckGui() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
94 func CheckGui() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
95 if !has('gui_running') |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
96 throw 'Skipped: only works in the GUI' |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
97 endif |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
98 endfunc |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
99 |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
100 " Command to check that not currently using the GUI |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
101 command CheckNotGui call CheckNotGui() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
102 func CheckNotGui() |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
103 if has('gui_running') |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
104 throw 'Skipped: only works in the terminal' |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
105 endif |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17614
diff
changeset
|
106 endfunc |
18277
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
107 |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
108 " Command to check that test is not running as root |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
109 command CheckNotRoot call CheckNotRoot() |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
110 func CheckNotRoot() |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
111 if IsRoot() |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
112 throw 'Skipped: cannot run test as root' |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
113 endif |
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
17668
diff
changeset
|
114 endfunc |