diff options
| author | Shougo <Shougo.Matsu@gmail.com> | 2022-04-03 21:27:46 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-03 20:27:46 +0800 |
| commit | e9e16655af1bacd4b1499fed00a142512c120710 (patch) | |
| tree | 06a77f45aaf25b49c4b907ed52b8ddf48ec794f2 /src/nvim/testdir | |
| parent | 6786b6afade97771027fda3c1438969def320cc5 (diff) | |
| download | rneovim-e9e16655af1bacd4b1499fed00a142512c120710.tar.gz rneovim-e9e16655af1bacd4b1499fed00a142512c120710.tar.bz2 rneovim-e9e16655af1bacd4b1499fed00a142512c120710.zip | |
[RFC] vim-patch:8.1.1378: delete() can not handle a file name that looks li… (#16268)
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 vim/vim#4424, closes vim/vim#696)
https://github.com/vim/vim/commit/701ff0a3e53d253d7300c385e582659bbff7860d
Cherry-pick a change to Test_delete_rf() from patch 8.1.1921.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_functions.vim | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index c2b5653a29..79f718f4e8 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1620,10 +1620,6 @@ func Test_platform_name() endfunc func Test_readdir() - if isdirectory('Xdir') - call delete('Xdir', 'rf') - endif - call mkdir('Xdir') call writefile([], 'Xdir/foo.txt') call writefile([], 'Xdir/bar.txt') @@ -1653,6 +1649,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('Xdir/[a-1]/foo.txt'->filereadable()) + + 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_equal(3, 'len'->call([123])) |