blob: e0723da6f00f916d08c366817f7f9dcfda4b8805 [file] [log] [blame]
Bram Moolenaar292eff02017-07-11 21:46:28 +02001" Test whether glob()/globpath() return correct results with certain escaped
2" characters.
3
4function SetUp()
5 " make sure glob() doesn't use the shell
6 set shell=doesnotexist
7 " consistent sorting of file names
8 set nofileignorecase
9endfunction
10
11function Test_glob()
Bram Moolenaar6e77df22017-11-21 11:43:08 +010012 if !has('unix')
13 " This test fails on Windows because of the special characters in the
14 " filenames. Disable the test on non-Unix systems for now.
15 return
16 endif
Bram Moolenaar292eff02017-07-11 21:46:28 +020017 call assert_equal("", glob('Xxx\{'))
18 call assert_equal("", glob('Xxx\$'))
19 w! Xxx{
20 w! Xxx\$
21 call assert_equal("Xxx{", glob('Xxx\{'))
22 call assert_equal("Xxx$", glob('Xxx\$'))
Bram Moolenaar6e77df22017-11-21 11:43:08 +010023 call delete('Xxx{')
24 call delete('Xxx$')
Bram Moolenaar292eff02017-07-11 21:46:28 +020025endfunction
26
27function Test_globpath()
Bram Moolenaar6e65d592017-12-07 22:11:27 +010028 call assert_equal("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim",
29 \ globpath('sautest/autoload', 'glob*.vim'))
30 call assert_equal(['sautest/autoload/globone.vim', 'sautest/autoload/globtwo.vim'],
31 \ globpath('sautest/autoload', 'glob*.vim', 0, 1))
Bram Moolenaar292eff02017-07-11 21:46:28 +020032endfunction