diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-11-07 06:18:16 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-07 06:18:16 +0800 |
| commit | 08d53633d41063f2d14ea7713edc70620ce1fcc4 (patch) | |
| tree | 0d1388abf2b3885805d29f3e619a051c187fae3c /src/nvim/testdir/test_help.vim | |
| parent | 16eed6e7663afccfe36fd8c0301927fd1858c5c8 (diff) | |
| parent | 8c454776f8a1d030b326347e1dd2d4e1fd6d7f7f (diff) | |
| download | rneovim-08d53633d41063f2d14ea7713edc70620ce1fcc4.tar.gz rneovim-08d53633d41063f2d14ea7713edc70620ce1fcc4.tar.bz2 rneovim-08d53633d41063f2d14ea7713edc70620ce1fcc4.zip | |
Merge pull request #20968 from zeertzjq/vim-8.2.2570
vim-patch:8.2.{2570,2623,2627,4495}: tests fail when run as root
Diffstat (limited to 'src/nvim/testdir/test_help.vim')
| -rw-r--r-- | src/nvim/testdir/test_help.vim | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/src/nvim/testdir/test_help.vim b/src/nvim/testdir/test_help.vim index 19c0fcd820..e30d305703 100644 --- a/src/nvim/testdir/test_help.vim +++ b/src/nvim/testdir/test_help.vim @@ -1,5 +1,7 @@ " Tests for :help +source check.vim + func Test_help_restore_snapshot() help set buftype= @@ -98,6 +100,7 @@ func Test_help_completion() endfunc " Test for the :helptags command +" NOTE: if you run tests as root this will fail. Don't run tests as root! func Test_helptag_cmd() call mkdir('Xdir/a/doc', 'p') @@ -111,29 +114,6 @@ func Test_helptag_cmd() call assert_equal(["help-tags\ttags\t1"], readfile('Xdir/tags')) call delete('Xdir/tags') - " The following tests fail on FreeBSD for some reason - if has('unix') && !has('bsd') - " Read-only tags file - call mkdir('Xdir/doc', 'p') - call writefile([''], 'Xdir/doc/tags') - call writefile([], 'Xdir/doc/sample.txt') - call setfperm('Xdir/doc/tags', 'r-xr--r--') - call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags')) - - let rtp = &rtp - let &rtp = 'Xdir' - helptags ALL - let &rtp = rtp - - call delete('Xdir/doc/tags') - - " No permission to read the help file - call setfperm('Xdir/a/doc/sample.txt', '-w-------') - call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/a/doc/sample.txt')) - call delete('Xdir/a/doc/sample.txt') - call delete('Xdir/tags') - endif - " Duplicate tags in the help file call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xdir/a/doc/sample.txt') call assert_fails('helptags Xdir', 'E154:') @@ -141,9 +121,35 @@ func Test_helptag_cmd() call delete('Xdir', 'rf') endfunc +func Test_helptag_cmd_readonly() + CheckUnix + CheckNotRoot + + " Read-only tags file + call mkdir('Xdir/doc', 'p') + call writefile([''], 'Xdir/doc/tags') + call writefile([], 'Xdir/doc/sample.txt') + call setfperm('Xdir/doc/tags', 'r-xr--r--') + call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags')) + + let rtp = &rtp + let &rtp = 'Xdir' + helptags ALL + let &rtp = rtp + + call delete('Xdir/doc/tags') + + " No permission to read the help file + call mkdir('Xdir/b/doc', 'p') + call writefile([], 'Xdir/b/doc/sample.txt') + call setfperm('Xdir/b/doc/sample.txt', '-w-------') + call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/b/doc/sample.txt')) + call delete('Xdir', 'rf') +endfunc + " Test for setting the 'helpheight' option in the help window func Test_help_window_height() - let &cmdheight = &lines - 24 + let &cmdheight = &lines - 23 set helpheight=10 help set helpheight=14 |