mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
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
8b34aea1b0
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
43d8435cf8
commit
6b022f9d8b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user