0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.0947: readdirex() doesn't handle broken link properly

Problem:    Readdirex() doesn't handle broken link properly.
Solution:   Small fixes to readdirex(). (Christian Brabandt, closes #6226,
            closes #6213)
This commit is contained in:
Bram Moolenaar
2020-06-10 15:55:36 +02:00
parent eebd555733
commit ab54032f29
3 changed files with 24 additions and 2 deletions

View File

@@ -1912,6 +1912,16 @@ func Test_readdirex()
\ ->map({-> v:val.name})
call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt'])
" report brocken link correctly
if has("unix")
call writefile([], 'Xdir/abc.txt')
call system("ln -s Xdir/abc.txt Xdir/link")
call delete('Xdir/abc.txt')
let files = readdirex('Xdir', 'readdirex("Xdir", "1") != []')
\ ->map({-> v:val.name .. '_' .. v:val.type})
call sort(files)->assert_equal(
\ ['bar.txt_file', 'dir_dir', 'foo.txt_file', 'link_link'])
endif
eval 'Xdir'->delete('rf')
endfunc