patch 8.2.4696: delete() with "rf" argument does not report a failure
Problem: delete() with "rf" argument does not report a failure.
Solution: Return -1 if the directory could not be removed. (closes #10078)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index a19dd52..a87ca3b 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2242,6 +2242,15 @@
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()