From fbe2761b20afaf25a02c06decaf543d211e997f0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Nov 2022 22:15:59 +0800 Subject: vim-patch:8.2.2623: some tests fail when run as root Problem: Some tests fail when run as root. Solution: Use CheckNotRoot. https://github.com/vim/vim/commit/17709e280ac5ba234b04641cde88d38e3522cedf Co-authored-by: Bram Moolenaar --- src/nvim/testdir/test_excmd.vim | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/nvim/testdir/test_excmd.vim') diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim index 91fdb23a63..0e8af08b4b 100644 --- a/src/nvim/testdir/test_excmd.vim +++ b/src/nvim/testdir/test_excmd.vim @@ -493,13 +493,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 @@ -512,6 +505,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:') -- cgit