annotate src/testdir/test_help.vim @ 22004:a9e60176dcd3 v8.2.1551

patch 8.2.1551: Vim9: error for argument type does not mention the number Commit: https://github.com/vim/vim/commit/8b565c2c1522e0c41e3d18e1bb6e1bc4b3686842 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 30 23:24:20 2020 +0200 patch 8.2.1551: Vim9: error for argument type does not mention the number Problem: Vim9: error for argument type does not mention the number. Solution: Pass the argument number to where the error is given.
author Bram Moolenaar <Bram@vim.org>
date Sun, 30 Aug 2020 23:30:04 +0200
parents 7096af834c42
children eeb5518a37aa
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
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_help_restore_snapshot()
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 set buftype=
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 edit x
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 help
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 helpclose
cb71a5468aca patch 8.0.0331: restoring help snapshot accesses freed memory
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endfunc
11167
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
11
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
12 func Test_help_errors()
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
13 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
14 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
15 if has('multi_lang')
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
16 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
17 endif
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
18
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
19 let save_hf = &helpfile
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
20 set helpfile=help_missing
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
21 help
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
22 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
23 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
24 let &helpfile = save_hf
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
25
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
26 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
27
55cf556d8ce1 patch 8.0.0998: strange error when using K while only spaces are selected
Christian Brabandt <cb@256bit.org>
parents: 11167
diff changeset
28 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
29 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
30 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
31 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
32 bwipe!
11167
260100346566 patch 8.0.0470: not enough testing for help commands
Christian Brabandt <cb@256bit.org>
parents: 10883
diff changeset
33 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
34
18237
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
35 func Test_help_expr()
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
36 help expr-!~?
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
37 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
38 close
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
39 endfunc
d0dfb3b0fe31 patch 8.1.2113: ":help expr-!~?" only works after searching
Bram Moolenaar <Bram@vim.org>
parents: 13014
diff changeset
40
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
41 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
42 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
43 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
44 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
45 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
46 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
47 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
48 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
49 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
50 endfunc
13014
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
51
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
52 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
53 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
54 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
55 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
56 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
57 set rtp+=./Xruntime
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
58 help
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
59 1
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
60 call search('mydoc.txt')
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
61 call assert_equal('|mydoc.txt| my awesome doc', getline('.'))
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
62 1
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
63 call search('mydoc-ext.txt')
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
64 call assert_equal('|mydoc-ext.txt| my extended awesome doc', getline('.'))
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
65 close
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
66
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
67 call delete('Xruntime', 'rf')
e1deb00ffc27 patch 8.0.1383: local additions in help skips some files
Christian Brabandt <cb@256bit.org>
parents: 12236
diff changeset
68 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
69 endfunc
18977
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
70
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
71 func Test_help_completion()
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18237
diff changeset
72 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
73 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
74 endfunc
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
75
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
76 " Test for the :helptags command
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
77 func Test_helptag_cmd()
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
78 call mkdir('Xdir/a/doc', 'p')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
79
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
80 " No help file to process in the directory
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
81 call assert_fails('helptags Xdir', 'E151:')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
82
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
83 call writefile([], 'Xdir/a/doc/sample.txt')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
84
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
85 " Test for ++t argument
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
86 helptags ++t Xdir
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
87 call assert_equal(["help-tags\ttags\t1"], readfile('Xdir/tags'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
88 call delete('Xdir/tags')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
89
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
90 " The following tests fail on FreeBSD for some reason
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
91 if has('unix') && !has('bsd')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
92 " Read-only tags file
19429
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
93 call mkdir('Xdir/doc', 'p')
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
94 call writefile([''], 'Xdir/doc/tags')
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
95 call writefile([], 'Xdir/doc/sample.txt')
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
96 call setfperm('Xdir/doc/tags', 'r-xr--r--')
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
97 call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags'))
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
98
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
99 let rtp = &rtp
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
100 let &rtp = 'Xdir'
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
101 helptags ALL
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
102 let &rtp = rtp
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
103
7096af834c42 patch 8.2.0272: ":helptags ALL" gives error for some directories
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
104 call delete('Xdir/doc/tags')
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
105
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
106 " No permission to read the help file
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
107 call setfperm('Xdir/a/doc/sample.txt', '-w-------')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
108 call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/a/doc/sample.txt'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
109 call delete('Xdir/a/doc/sample.txt')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
110 call delete('Xdir/tags')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
111 endif
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
112
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
113 " Duplicate tags in the help file
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
114 call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xdir/a/doc/sample.txt')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
115 call assert_fails('helptags Xdir', 'E154:')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
116
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
117 call delete('Xdir', 'rf')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
118 endfunc
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
119
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
120 " vim: shiftwidth=2 sts=2 expandtab