aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_escaped_glob.vim
blob: 430317a23abcd56223fb669e76c519c9f67c86d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
" Test whether glob()/globpath() return correct results with certain escaped
" characters.

function SetUp()
  " make sure glob() doesn't use the shell
  set shell=doesnotexist
  " consistent sorting of file names
  set nofileignorecase
endfunction

function Test_glob()
  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
  call assert_equal("", glob('Xxx\{'))
  call assert_equal("", glob('Xxx\$'))
  w! Xxx{
  w! Xxx\$
  call assert_equal("Xxx{", glob('Xxx\{'))
  call assert_equal("Xxx$", glob('Xxx\$'))
  call delete('Xxx{')
  call delete('Xxx$')
endfunction

function Test_globpath()
  let slash = (!exists('+shellslash') || &shellslash) ? '/' : '\'
  call assert_equal('sautest'.slash.'autoload'.slash.'footest.vim',
        \ globpath('sautest/autoload', '*.vim'))
  call assert_equal(['sautest'.slash.'autoload'.slash.'footest.vim'],
        \ globpath('sautest/autoload', '*.vim', 0, 1))
endfunction