diff options
-rw-r--r-- | src/testdir/test_edit.vim | 3 | ||||
-rw-r--r-- | src/testdir/test_excmd.vim | 18 | ||||
-rw-r--r-- | src/testdir/test_help.vim | 54 | ||||
-rw-r--r-- | src/testdir/test_writefile.vim | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 49 insertions, 31 deletions
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index 0b44c7df3..dd7e743fc 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1704,9 +1704,10 @@ func Test_edit_charconvert() endfunc " Test for editing a file without read permission -" NOTE: if you run tests as root this will fail. Don't run tests as root! func Test_edit_file_no_read_perm() CheckUnix + CheckNotRoot + call writefile(['one', 'two'], 'Xfile') call setfperm('Xfile', '-w-------') new diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim index 0170a9f3b..cbeedfa8f 100644 --- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -350,13 +350,6 @@ func Test_redir_cmd() call assert_fails('redir > Xdir', 'E17:') call delete('Xdir', 'd') endif - if !has('bsd') - " Redirecting to a read-only file - call writefile([], 'Xfile') - call setfperm('Xfile', 'r--r--r--') - call assert_fails('redir! > Xfile', 'E190:') - call delete('Xfile') - endif " Test for redirecting to a register redir @q> | echon 'clean ' | redir END @@ -369,6 +362,17 @@ func Test_redir_cmd() call assert_equal('blue sky', color) endfunc +func Test_redir_cmd_readonly() + CheckNotRoot + CheckNotBSD + + " Redirecting to a read-only file + call writefile([], 'Xfile') + call setfperm('Xfile', 'r--r--r--') + call assert_fails('redir! > Xfile', 'E190:') + call delete('Xfile') +endfunc + " Test for the :filetype command func Test_filetype_cmd() call assert_fails('filetype abc', 'E475:') diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim index 966616c97..b3e3c557f 100644 --- a/src/testdir/test_help.vim +++ b/src/testdir/test_help.vim @@ -1,5 +1,7 @@ " Tests for :help +source check.vim + func Test_help_restore_snapshot() help set buftype= @@ -88,29 +90,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:') @@ -118,4 +97,33 @@ func Test_helptag_cmd() call delete('Xdir', 'rf') endfunc +func Test_helptag_cmd_readonly() + CheckUnix + CheckNotRoot + " The following tests fail on FreeBSD for some reason + CheckNotBSD + + " 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 + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim index e7a309a08..7256c6584 100644 --- a/src/testdir/test_writefile.vim +++ b/src/testdir/test_writefile.vim @@ -410,6 +410,9 @@ endfunc func Test_write_readonly_dir() " On MS-Windows, modifying files in a read-only directory is allowed. CheckUnix + " Root can do it too. + CheckNotRoot + call mkdir('Xdir') call writefile(['one'], 'Xdir/Xfile1') call setfperm('Xdir', 'r-xr--r--') diff --git a/src/version.c b/src/version.c index a650c813a..117dacc6a 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2623, +/**/ 2622, /**/ 2621, |