diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-06-14 05:48:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 05:48:23 +0800 |
commit | 6b022f9d8bb7b3610384dbcbba336583f2109b5e (patch) | |
tree | 401a05c73b6a9ea295470d5214a823dd81137a27 | |
parent | 43d8435cf84468e776e0a6a98d05ae7bd62583b7 (diff) | |
download | rneovim-6b022f9d8bb7b3610384dbcbba336583f2109b5e.tar.gz rneovim-6b022f9d8bb7b3610384dbcbba336583f2109b5e.tar.bz2 rneovim-6b022f9d8bb7b3610384dbcbba336583f2109b5e.zip |
vim-patch:9.1.0483: glob() not sufficiently tested (#29323)
Problem: glob() not sufficiently tested
Solution: Add more tests for directory containing [] chars
related: vim/vim#14991
https://github.com/vim/vim/commit/8b34aea1b0431082a062ecfb5de0f244f3f23418
Co-authored-by: Christian Brabandt <cb@256bit.org>
-rw-r--r-- | test/old/testdir/test_functions.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index fa9ae63381..81e843ba8d 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3448,6 +3448,33 @@ func Test_glob() call assert_fails("call glob('*', 0, {})", 'E728:') endfunc +func Test_glob2() + call mkdir('[XglobDir]', 'R') + call mkdir('abc[glob]def', 'R') + + call writefile(['glob'], '[XglobDir]/Xglob') + call writefile(['glob'], 'abc[glob]def/Xglob') + if has("unix") + call assert_equal([], (glob('[XglobDir]/*', 0, 1))) + call assert_equal([], (glob('abc[glob]def/*', 0, 1))) + call assert_equal(['[XglobDir]/Xglob'], (glob('\[XglobDir]/*', 0, 1))) + call assert_equal(['abc[glob]def/Xglob'], (glob('abc\[glob]def/*', 0, 1))) + elseif has("win32") + let _sl=&shellslash + call assert_equal([], (glob('[XglobDir]\*', 0, 1))) + call assert_equal([], (glob('abc[glob]def\*', 0, 1))) + call assert_equal([], (glob('\[XglobDir]\*', 0, 1))) + call assert_equal([], (glob('abc\[glob]def\*', 0, 1))) + set noshellslash + call assert_equal(['[XglobDir]\Xglob'], (glob('[[]XglobDir]/*', 0, 1))) + call assert_equal(['abc[glob]def\Xglob'], (glob('abc[[]glob]def/*', 0, 1))) + set shellslash + call assert_equal(['[XglobDir]/Xglob'], (glob('[[]XglobDir]/*', 0, 1))) + call assert_equal(['abc[glob]def/Xglob'], (glob('abc[[]glob]def/*', 0, 1))) + let &shellslash=_sl + endif +endfunc + " Test for browse() func Test_browse() CheckFeature browse |