blob: c550ff09e2f915c975420b88a3794fcacf9af46a [file] [log] [blame]
Bram Moolenaar343b8c02017-02-17 12:04:56 +01001" Tests for :help
2
3func Test_help_restore_snapshot()
4 help
5 set buftype=
6 help
7 edit x
8 help
9 helpclose
10endfunc
Bram Moolenaar751ba612017-03-16 22:26:44 +010011
12func Test_help_errors()
13 call assert_fails('help doesnotexist', 'E149:')
14 call assert_fails('help!', 'E478:')
Bram Moolenaara4f99f52017-08-26 16:25:32 +020015
16 new
17 set keywordprg=:help
18 call setline(1, " ")
19 call assert_fails('normal VK', 'E349:')
20 bwipe!
21endfunc
22
23func Test_help_keyword()
24 new
25 set keywordprg=:help
26 call setline(1, " Visual ")
27 normal VK
28 call assert_match('^Visual mode', getline('.'))
29 call assert_equal('help', &ft)
30 close
31 bwipe!
Bram Moolenaar751ba612017-03-16 22:26:44 +010032endfunc
Bram Moolenaar35c5e812017-12-09 21:10:13 +010033
34func Test_help_local_additions()
35 call mkdir('Xruntime/doc', 'p')
36 call writefile(['*mydoc.txt* my awesome doc'], 'Xruntime/doc/mydoc.txt')
37 call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt')
38 let rtp_save = &rtp
39 set rtp+=./Xruntime
40 help
41 1
42 call search('mydoc.txt')
43 call assert_equal('|mydoc.txt| my awesome doc', getline('.'))
44 1
45 call search('mydoc-ext.txt')
46 call assert_equal('|mydoc-ext.txt| my extended awesome doc', getline('.'))
47 close
48
49 call delete('Xruntime', 'rf')
50 let &rtp = rtp_save
51endfunc