Skip to content

Commit 4a1ad55

Browse files
k-takatachrisbra
authored andcommitted
patch 9.0.1972: win32: missing '**' expansion test
Problem: win32: missing '**' expansion test (after v9.0.1947) Solution: Add test for MS-Windows win32: Add "**" test Vim supports "**" on MS-Windows. However, it is not tested by `Test_glob_extended_bash`. Unlike Unix, it doesn't use 'shell' and doesn't support {,} expansion. So, I added as a separate test. related: #13205 closes: #13250 Signed-off-by: Christian Brabandt <[email protected]> Co-authored-by: Ken Takata <[email protected]>
1 parent f59cbef commit 4a1ad55

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

runtime/doc/editing.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ is to use "path\[[]abc]", this matches the file "path\[abc]".
386386

387387
*starstar-wildcard*
388388
Expanding "**" is possible on Unix, Win32, macOS and a few other systems (but
389-
it may depend on your 'shell' setting. It's known to work correctly for zsh; for
390-
bash this requires at least bash version >= 4.X).
389+
it may depend on your 'shell' setting on Unix and macOS. It's known to work
390+
correctly for zsh; for bash this requires at least bash version >= 4.X).
391391
This allows searching a directory tree. This goes up to 100 directories deep.
392392
Note there are some commands where this works slightly differently, see
393393
|file-searching|.

src/testdir/test_functions.vim

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3647,4 +3647,22 @@ func Test_glob_extended_bash()
36473647
let &shell=_shell
36483648
endfunc
36493649

3650+
" Test for glob() with extended patterns (MS-Windows)
3651+
" Vim doesn't use 'shell' to expand wildcards on MS-Windows.
3652+
" Unlike bash, it doesn't support {,} expansion.
3653+
func Test_glob_extended_mswin()
3654+
CheckMSWindows
3655+
3656+
call mkdir('Xtestglob/foo/bar/src', 'p')
3657+
call writefile([], 'Xtestglob/foo/bar/src/foo.sh')
3658+
call writefile([], 'Xtestglob/foo/bar/src/foo.h')
3659+
call writefile([], 'Xtestglob/foo/bar/src/foo.cpp')
3660+
3661+
" Sort output of glob() otherwise we end up with different
3662+
" ordering depending on whether file system is case-sensitive.
3663+
let expected = ['Xtestglob/foo/bar/src/foo.cpp', 'Xtestglob/foo/bar/src/foo.h', 'Xtestglob/foo/bar/src/foo.sh']
3664+
call assert_equal(expected, sort(glob('Xtestglob/**/foo.*', 0, 1)))
3665+
call delete('Xtestglob', 'rf')
3666+
endfunc
3667+
36503668
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1972,
707709
/**/
708710
1971,
709711
/**/

0 commit comments

Comments
 (0)