From 128bedc0d2435bbc754cdb954447fc1cbfd4ac13 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 6 Apr 2022 05:12:49 +0800 Subject: vim-patch:8.2.4696: delete() with "rf" argument does not report a failure (#18002) Problem: delete() with "rf" argument does not report a failure. Solution: Return -1 if the directory could not be removed. (closes vim/vim#10078) https://github.com/vim/vim/commit/478700336d1c72e133b8ff6841e968c1bb1658ed --- src/nvim/testdir/test_functions.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 79f718f4e8..f8be250f73 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1662,6 +1662,15 @@ func Test_delete_rf() call assert_equal(0, delete('Xdir', 'rf')) call assert_false(filereadable('Xdir/foo.txt')) call assert_false(filereadable('Xdir/[a-1]/foo.txt')) + + if has('unix') + call mkdir('Xdir/Xdir2', 'p') + silent !chmod 555 Xdir + call assert_equal(-1, delete('Xdir/Xdir2', 'rf')) + call assert_equal(-1, delete('Xdir', 'rf')) + silent !chmod 755 Xdir + call assert_equal(0, delete('Xdir', 'rf')) + endif endfunc func Test_call() -- cgit