summaryrefslogtreecommitdiff
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-10 15:55:36 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-10 15:55:36 +0200
commitab54032f297e9418b0d83970cbe3a414d6ef08c4 (patch)
treecf03e2e5f08dedc70f0a12823d3c52e32ed5ffef /src/testdir/test_functions.vim
parenteebd555733491cb55b9f30fe28772c0fd0ebacf7 (diff)
downloadvim-git-ab54032f297e9418b0d83970cbe3a414d6ef08c4.tar.gz
patch 8.2.0947: readdirex() doesn't handle broken link properlyv8.2.0947
Problem: Readdirex() doesn't handle broken link properly. Solution: Small fixes to readdirex(). (Christian Brabandt, closes #6226, closes #6213)
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index d3bf1db25..f83264b48 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -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