Mercurial > vim
comparison src/testdir/test_functions.vim @ 20790:5a9c42c6a69e v8.2.0947
patch 8.2.0947: readdirex() doesn't handle broken link properly
Commit: https://github.com/vim/vim/commit/ab54032f297e9418b0d83970cbe3a414d6ef08c4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 10 15:55:36 2020 +0200
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 https://github.com/vim/vim/issues/6226,
closes #6213)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 Jun 2020 16:00:05 +0200 |
parents | 072ad890c227 |
children | 2e7acc208a1f |
comparison
equal
deleted
inserted
replaced
20789:7177dae667cd | 20790:5a9c42c6a69e |
---|---|
1910 " Nested readdirex() must not crash | 1910 " Nested readdirex() must not crash |
1911 let files = readdirex('Xdir', 'readdirex("Xdir", "1") != []') | 1911 let files = readdirex('Xdir', 'readdirex("Xdir", "1") != []') |
1912 \ ->map({-> v:val.name}) | 1912 \ ->map({-> v:val.name}) |
1913 call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt']) | 1913 call sort(files)->assert_equal(['bar.txt', 'dir', 'foo.txt']) |
1914 | 1914 |
1915 " report brocken link correctly | |
1916 if has("unix") | |
1917 call writefile([], 'Xdir/abc.txt') | |
1918 call system("ln -s Xdir/abc.txt Xdir/link") | |
1919 call delete('Xdir/abc.txt') | |
1920 let files = readdirex('Xdir', 'readdirex("Xdir", "1") != []') | |
1921 \ ->map({-> v:val.name .. '_' .. v:val.type}) | |
1922 call sort(files)->assert_equal( | |
1923 \ ['bar.txt_file', 'dir_dir', 'foo.txt_file', 'link_link']) | |
1924 endif | |
1915 eval 'Xdir'->delete('rf') | 1925 eval 'Xdir'->delete('rf') |
1916 endfunc | 1926 endfunc |
1917 | 1927 |
1918 func Test_delete_rf() | 1928 func Test_delete_rf() |
1919 call mkdir('Xdir') | 1929 call mkdir('Xdir') |