diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-24 14:14:14 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-24 14:14:14 +0200 |
commit | 701ff0a3e53d253d7300c385e582659bbff7860d (patch) | |
tree | eddc34bc71630171f38699a49d07adb53ad98f0a /src/testdir/test_functions.vim | |
parent | fcc4d921d6761b833ae89ca3dc450c48c270ca36 (diff) |
patch 8.1.1378: delete() can not handle a file name that looks like a patternv8.1.1378
Problem: Delete() can not handle a file name that looks like a pattern.
Solution: Use readdir() instead of appending "/*" and expanding wildcards.
(Ken Takata, closes #4424, closes #696)
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r-- | src/testdir/test_functions.vim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index b9520c7ee6..3e4c03cdbe 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -1436,6 +1436,21 @@ func Test_readdir() call delete('Xdir', 'rf') endfunc +func Test_delete_rf() + call mkdir('Xdir') + call writefile([], 'Xdir/foo.txt') + call writefile([], 'Xdir/bar.txt') + call mkdir('Xdir/[a-1]') " issue #696 + call writefile([], 'Xdir/[a-1]/foo.txt') + call writefile([], 'Xdir/[a-1]/bar.txt') + call assert_true(filereadable('Xdir/foo.txt')) + call assert_true(filereadable('Xdir/[a-1]/foo.txt')) + + call assert_equal(0, delete('Xdir', 'rf')) + call assert_false(filereadable('Xdir/foo.txt')) + call assert_false(filereadable('Xdir/[a-1]/foo.txt')) +endfunc + func Test_call() call assert_equal(3, call('len', [123])) call assert_fails("call call('len', 123)", 'E714:') |