annotate src/testdir/test_help.vim @ 30459:300e973cb91d v9.0.0565

patch 9.0.0565: cscope test causes problems with test timeout timer Commit: https://github.com/vim/vim/commit/dfa8be4944b49c228d401e788aaade47b4abb658 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 23 23:19:18 2022 +0100 patch 9.0.0565: cscope test causes problems with test timeout timer Problem: Cscope test causes problems when code for test timeout timer is included (even when commented out). Solution: Disable part of the cscope test for now.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Sep 2022 00:30:07 +0200
parents d891115c0aea
children bcd204e28fed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10883
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for :help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
3 source check.vim
27466
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
4 import './vim9.vim' as v9
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
5
10883
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 func Test_help_restore_snapshot()
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set buftype=
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 edit x
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 helpclose
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfunc
11167
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
14
28688
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
15 func Test_help_restore_snapshot_split()
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
16 " Squeeze the unnamed buffer, Xfoo and the help one side-by-side and focus
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
17 " the first one before calling :help.
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
18 let bnr = bufnr()
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
19 botright vsp Xfoo
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
20 wincmd h
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
21 help
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
22 wincmd L
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
23 let g:did_bufenter = v:false
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
24 augroup T
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
25 au!
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
26 au BufEnter Xfoo let g:did_bufenter = v:true
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
27 augroup END
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
28 helpclose
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
29 augroup! T
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
30 " We're back to the unnamed buffer.
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
31 call assert_equal(bnr, bufnr())
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
32 " No BufEnter was triggered for Xfoo.
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
33 call assert_equal(v:false, g:did_bufenter)
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
34
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
35 close!
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
36 bwipe!
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
37 endfunc
264fa41e6704 patch 8.2.4868: when closing help window autocmds triggered for wrong window
Bram Moolenaar <Bram@vim.org>
parents: 27940
diff changeset
38
11167
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
39 func Test_help_errors()
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
40 call assert_fails('help doesnotexist', 'E149:')
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
41 call assert_fails('help!', 'E478:')
19277
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
42 if has('multi_lang')
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
43 call assert_fails('help help@xy', 'E661:')
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
44 endif
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
45
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
46 let save_hf = &helpfile
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
47 set helpfile=help_missing
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
48 help
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
49 call assert_equal(1, winnr('$'))
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
50 call assert_notequal('help', &buftype)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
51 let &helpfile = save_hf
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
52
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
53 call assert_fails('help ' . repeat('a', 1048), 'E149:')
12236
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
54
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
55 new
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
56 set keywordprg=:help
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
57 call setline(1, " ")
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
58 call assert_fails('normal VK', 'E349:')
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
59 bwipe!
11167
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
60 endfunc
12236
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
61
18237
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
62 func Test_help_expr()
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
63 help expr-!~?
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
64 call assert_equal('eval.txt', expand('%:t'))
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
65 close
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
66 endfunc
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
67
12236
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
68 func Test_help_keyword()
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
69 new
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
70 set keywordprg=:help
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
71 call setline(1, " Visual ")
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
72 normal VK
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
73 call assert_match('^Visual mode', getline('.'))
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
74 call assert_equal('help', &ft)
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
75 close
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
76 bwipe!
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
77 endfunc
13014
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
78
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
79 func Test_help_local_additions()
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
80 call mkdir('Xruntime/doc', 'p')
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
81 call writefile(['*mydoc.txt* my awesome doc'], 'Xruntime/doc/mydoc.txt')
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
82 call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt')
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
83 let rtp_save = &rtp
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
84 set rtp+=./Xruntime
26927
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
85 help local-additions
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
86 let lines = getline(line(".") + 1, search("^$") - 1)
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
87 call assert_equal([
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
88 \ '|mydoc-ext.txt| my extended awesome doc',
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
89 \ '|mydoc.txt| my awesome doc'
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
90 \ ], lines)
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
91 call delete('Xruntime/doc/mydoc-ext.txt')
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
92 close
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
93
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
94 call mkdir('Xruntime-ja/doc', 'p')
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
95 call writefile(["local-additions\thelp.jax\t/*local-additions*"], 'Xruntime-ja/doc/tags-ja')
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
96 call writefile(['*help.txt* This is jax file', '',
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
97 \ 'LOCAL ADDITIONS: *local-additions*', ''], 'Xruntime-ja/doc/help.jax')
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
98 call writefile(['*work.txt* This is jax file'], 'Xruntime-ja/doc/work.jax')
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
99 call writefile(['*work2.txt* This is jax file'], 'Xruntime-ja/doc/work2.jax')
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
100 set rtp+=./Xruntime-ja
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
101
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
102 help local-additions@en
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
103 let lines = getline(line(".") + 1, search("^$") - 1)
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
104 call assert_equal([
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
105 \ '|mydoc.txt| my awesome doc'
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
106 \ ], lines)
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
107 close
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
108
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
109 help local-additions@ja
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
110 let lines = getline(line(".") + 1, search("^$") - 1)
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
111 call assert_equal([
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
112 \ '|mydoc.txt| my awesome doc',
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
113 \ '|help.txt| This is jax file',
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
114 \ '|work.txt| This is jax file',
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
115 \ '|work2.txt| This is jax file',
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
116 \ ], lines)
13014
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
117 close
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
118
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
119 call delete('Xruntime', 'rf')
26927
e3f3108a780a patch 8.2.3992: wrong local-additions in the help with language mix
Bram Moolenaar <Bram@vim.org>
parents: 26276
diff changeset
120 call delete('Xruntime-ja', 'rf')
13014
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
121 let &rtp = rtp_save
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
122 endfunc
18977
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
123
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
124 func Test_help_completion()
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
125 call feedkeys(":help :undo\<C-A>\<C-B>\"\<CR>", 'tx')
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
126 call assert_equal('"help :undo :undoj :undol :undojoin :undolist', @:)
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
127 endfunc
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
128
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
129 " Test for the :helptags command
24057
eeb5518a37aa patch 8.2.2570: tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 19429
diff changeset
130 " NOTE: if you run tests as root this will fail. Don't run tests as root!
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
131 func Test_helptag_cmd()
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
132 call mkdir('Xtagdir/a/doc', 'p')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
133
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
134 " No help file to process in the directory
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
135 call assert_fails('helptags Xtagdir', 'E151:')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
136
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
137 call writefile([], 'Xtagdir/a/doc/sample.txt')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
138
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
139 " Test for ++t argument
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
140 helptags ++t Xtagdir
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
141 call assert_equal(["help-tags\ttags\t1"], readfile('Xtagdir/tags'))
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
142 call delete('Xtagdir/tags')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
143
29538
af4ffc4b2a26 patch 9.0.0110: help tag generation picks up words in code examples
Bram Moolenaar <Bram@vim.org>
parents: 28688
diff changeset
144 " Test parsing tags
af4ffc4b2a26 patch 9.0.0110: help tag generation picks up words in code examples
Bram Moolenaar <Bram@vim.org>
parents: 28688
diff changeset
145 call writefile(['*tag1*', 'Example: >', ' *notag*', 'Example end: *tag2*'],
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
146 \ 'Xtagdir/a/doc/sample.txt')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
147 helptags Xtagdir
29538
af4ffc4b2a26 patch 9.0.0110: help tag generation picks up words in code examples
Bram Moolenaar <Bram@vim.org>
parents: 28688
diff changeset
148 call assert_equal(["tag1\ta/doc/sample.txt\t/*tag1*",
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
149 \ "tag2\ta/doc/sample.txt\t/*tag2*"], readfile('Xtagdir/tags'))
29538
af4ffc4b2a26 patch 9.0.0110: help tag generation picks up words in code examples
Bram Moolenaar <Bram@vim.org>
parents: 28688
diff changeset
150
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
151 " Duplicate tags in the help file
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
152 call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xtagdir/a/doc/sample.txt')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
153 call assert_fails('helptags Xtagdir', 'E154:')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
154
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
155 call delete('Xtagdir', 'rf')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
156 endfunc
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
157
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
158 func Test_helptag_cmd_readonly()
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
159 CheckUnix
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
160 CheckNotRoot
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
161
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
162 " Read-only tags file
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
163 call mkdir('Xrodir/doc', 'p')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
164 call writefile([''], 'Xrodir/doc/tags')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
165 call writefile([], 'Xrodir/doc/sample.txt')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
166 call setfperm('Xrodir/doc/tags', 'r-xr--r--')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
167 call assert_fails('helptags Xrodir/doc', 'E152:', getfperm('Xrodir/doc/tags'))
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
168
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
169 let rtp = &rtp
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
170 let &rtp = 'Xrodir'
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
171 helptags ALL
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
172 let &rtp = rtp
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
173
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
174 call delete('Xrodir/doc/tags')
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
175
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
176 " No permission to read the help file
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
177 call mkdir('Xrodir/b/doc', 'p')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
178 call writefile([], 'Xrodir/b/doc/sample.txt')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
179 call setfperm('Xrodir/b/doc/sample.txt', '-w-------')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
180 call assert_fails('helptags Xrodir', 'E153:', getfperm('Xrodir/b/doc/sample.txt'))
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 29538
diff changeset
181 call delete('Xrodir', 'rf')
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
182 endfunc
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
183
24882
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
184 " Test for setting the 'helpheight' option in the help window
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
185 func Test_help_window_height()
27940
6ba17bf0f86a patch 8.2.4495: help test fails in 24 line terminal
Bram Moolenaar <Bram@vim.org>
parents: 27466
diff changeset
186 let &cmdheight = &lines - 23
24882
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
187 set helpheight=10
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
188 help
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
189 set helpheight=14
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
190 call assert_equal(14, winheight(0))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
191 set helpheight& cmdheight=1
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
192 close
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24172
diff changeset
193 endfunc
24164
2259c73cc1d9 patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 24057
diff changeset
194
26276
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
195 func Test_help_long_argument()
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
196 try
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
197 exe 'help \%' .. repeat('0', 1021)
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
198 catch
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
199 call assert_match("E149:", v:exception)
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
200 endtry
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
201 endfunc
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
202
27466
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
203 func Test_help_using_visual_match()
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
204 let lines =<< trim END
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
205 call setline(1, ' ')
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
206 /^
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
207 exe "normal \<C-V>\<C-V>"
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
208 h5\%V€]
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
209 END
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
210 call v9.CheckScriptFailure(lines, 'E149:')
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
211 endfunc
8ed815f061af patch 8.2.4261: accessing invalid memory in a regular expression
Bram Moolenaar <Bram@vim.org>
parents: 26927
diff changeset
212
26276
35d000f3d591 patch 8.2.3669: buffer overflow with long help argument
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
213
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
214 " vim: shiftwidth=2 sts=2 expandtab