annotate src/testdir/test_help.vim @ 19277:1b02482e6a61 v8.2.0197

patch 8.2.0197: some Ex commands not sufficiently tested Commit: https://github.com/vim/vim/commit/ea3db914c0fa35797ad73f6d5bb3a4288d690065 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 2 15:32:13 2020 +0100 patch 8.2.0197: some Ex commands not sufficiently tested Problem: Some Ex commands not sufficiently tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5565)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Feb 2020 15:45:03 +0100
parents 5bef1043abff
children 2f0f308c069c
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