2018-02-24 13:35:28 -07:00
|
|
|
" Test whether glob()/globpath() return correct results with certain escaped
|
|
|
|
" characters.
|
|
|
|
|
|
|
|
function SetUp()
|
|
|
|
" consistent sorting of file names
|
|
|
|
set nofileignorecase
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function Test_glob()
|
2018-07-11 01:07:55 -07:00
|
|
|
if !has('unix')
|
|
|
|
" This test fails on Windows because of the special characters in the
|
|
|
|
" filenames. Disable the test on non-Unix systems for now.
|
|
|
|
return
|
|
|
|
endif
|
2018-10-14 16:23:46 -07:00
|
|
|
|
|
|
|
" Execute these commands in the sandbox, so that using the shell fails.
|
|
|
|
" Setting 'shell' to an invalid name causes a memory leak.
|
|
|
|
sandbox call assert_equal("", glob('Xxx\{'))
|
|
|
|
sandbox call assert_equal("", glob('Xxx\$'))
|
2018-02-24 13:35:28 -07:00
|
|
|
w! Xxx{
|
2018-09-09 14:50:48 -07:00
|
|
|
" } to fix highlighting
|
2018-02-24 13:35:28 -07:00
|
|
|
w! Xxx\$
|
2018-10-14 16:23:46 -07:00
|
|
|
sandbox call assert_equal("Xxx{", glob('Xxx\{'))
|
|
|
|
sandbox call assert_equal("Xxx$", glob('Xxx\$'))
|
2018-07-11 01:07:55 -07:00
|
|
|
call delete('Xxx{')
|
|
|
|
call delete('Xxx$')
|
2018-02-24 13:35:28 -07:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function Test_globpath()
|
2018-10-14 16:23:46 -07:00
|
|
|
sandbox call assert_equal(expand("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim"),
|
2018-09-09 14:50:48 -07:00
|
|
|
\ globpath('sautest/autoload', 'glob*.vim'))
|
2018-10-14 16:23:46 -07:00
|
|
|
sandbox call assert_equal([expand('sautest/autoload/globone.vim'), expand('sautest/autoload/globtwo.vim')],
|
2018-09-09 14:50:48 -07:00
|
|
|
\ globpath('sautest/autoload', 'glob*.vim', 0, 1))
|
2018-02-24 13:35:28 -07:00
|
|
|
endfunction
|