blob: b91c6e742493f9227294b57bb709d8f5bd3b713b [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()
28 call assert_equal("sautest/autoload/Test104.vim\nsautest/autoload/footest.vim",
29 \ globpath('sautest/autoload', '*.vim'))
30 call assert_equal(['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim'],
31 \ globpath('sautest/autoload', '*.vim', 0, 1))
32endfunction