summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-06-13 21:20:20 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-13 21:20:20 +0200
commit8b34aea1b0431082a062ecfb5de0f244f3f23418 (patch)
treef2e13255194a49c1ae7b4e2d03d537f4f08f2006
parent1cd31a4501c48dbeae272de7394fa39ede7b10dd (diff)
patch 9.1.0483: glob() not sufficiently testedv9.1.0483
Problem: glob() not sufficiently tested Solution: Add more tests for directory containing [] chars related: #14991 Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/testdir/test_functions.vim27
-rw-r--r--src/version.c2
2 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index fd82801e65..acdb9544fd 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -3795,6 +3795,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
diff --git a/src/version.c b/src/version.c
index 43a09d308b..2df2071085 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 483,
+/**/
482,
/**/
481,