aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_excmd.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-07 06:18:16 +0800
committerGitHub <noreply@github.com>2022-11-07 06:18:16 +0800
commit08d53633d41063f2d14ea7713edc70620ce1fcc4 (patch)
tree0d1388abf2b3885805d29f3e619a051c187fae3c /src/nvim/testdir/test_excmd.vim
parent16eed6e7663afccfe36fd8c0301927fd1858c5c8 (diff)
parent8c454776f8a1d030b326347e1dd2d4e1fd6d7f7f (diff)
downloadrneovim-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_excmd.vim')
-rw-r--r--src/nvim/testdir/test_excmd.vim18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim
index 582dcaac2c..42b1f8ca48 100644
--- a/src/nvim/testdir/test_excmd.vim
+++ b/src/nvim/testdir/test_excmd.vim
@@ -476,6 +476,7 @@ func Test_winsize_cmd()
endfunc
" Test for the :redir command
+" NOTE: if you run tests as root this will fail. Don't run tests as root!
func Test_redir_cmd()
call assert_fails('redir @@', 'E475:')
call assert_fails('redir abc', 'E475:')
@@ -492,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
@@ -511,6 +505,16 @@ func Test_redir_cmd()
call assert_equal('blue sky', color)
endfunc
+func Test_redir_cmd_readonly()
+ CheckNotRoot
+
+ " 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:')