aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-19 06:32:02 +0800
committerGitHub <noreply@github.com>2024-06-19 06:32:02 +0800
commita2d510e1015d57f28ab20c5d2897527cae15b9c4 (patch)
treed8da593626529804918411620a75394e92041759
parent6012f79557b8807593c1c88b75e54f14a88d5173 (diff)
downloadrneovim-a2d510e1015d57f28ab20c5d2897527cae15b9c4.tar.gz
rneovim-a2d510e1015d57f28ab20c5d2897527cae15b9c4.tar.bz2
rneovim-a2d510e1015d57f28ab20c5d2897527cae15b9c4.zip
vim-patch:9.1.0499: MS-Windows: doesn't handle symlinks properly (#29400)
Problem: MS-Windows: doesn't handle symlinks properly (Timothy Madden) Solution: Implement lstat() on MS-Windows (author) lstat() differs from stat() in how it handles symbolic links, the former doesn't resolve the symlink while the latter does so. Implement a simple yet effective fallback using Win32 APIs. fixes vim/vim#14933 closes: vim/vim#15014 https://github.com/vim/vim/commit/23c5ebeb95cb942df307946e3ced230a7c8312eb Co-authored-by: LemonBoy <thatlemon@gmail.com> Co-authored-by: K.Takata <kentkt@csc.jp>
-rw-r--r--test/old/testdir/test_functions.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim
index 81e843ba8d..3faa720850 100644
--- a/test/old/testdir/test_functions.vim
+++ b/test/old/testdir/test_functions.vim
@@ -3475,6 +3475,29 @@ func Test_glob2()
endif
endfunc
+func Test_glob_symlinks()
+ call writefile([], 'Xglob1')
+
+ if has("win32")
+ silent !mklink XglobBad DoesNotExist
+ if v:shell_error
+ throw 'Skipped: cannot create symlinks'
+ endif
+ silent !mklink XglobOk Xglob1
+ else
+ silent !ln -s DoesNotExist XglobBad
+ silent !ln -s Xglob1 XglobOk
+ endif
+
+ " The broken symlink is excluded when alllinks is false.
+ call assert_equal(['Xglob1', 'XglobBad', 'XglobOk'], sort(glob('Xglob*', 0, 1, 1)))
+ call assert_equal(['Xglob1', 'XglobOk'], sort(glob('Xglob*', 0, 1, 0)))
+
+ call delete('Xglob1')
+ call delete('XglobBad')
+ call delete('XglobOk')
+endfunc
+
" Test for browse()
func Test_browse()
CheckFeature browse