neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

test_escaped_glob.vim (1169B)


      1 " Test whether glob()/globpath() return correct results with certain escaped
      2 " characters.
      3 
      4 func SetUp()
      5  " consistent sorting of file names
      6  set nofileignorecase
      7 endfunction
      8 
      9 function Test_glob()
     10  if !has('unix')
     11    " This test fails on Windows because of the special characters in the
     12    " filenames. Disable the test on non-Unix systems for now.
     13    return
     14  endif
     15 
     16  " Execute these commands in the sandbox, so that using the shell fails.
     17  " Setting 'shell' to an invalid name causes a memory leak.
     18  sandbox call assert_equal("", glob('Xxx\{'))
     19  sandbox call assert_equal("", 'Xxx\$'->glob())
     20  w! Xxx\{
     21  " } to fix highlighting
     22  w! Xxx\$
     23  sandbox call assert_equal("Xxx{", glob('Xxx\{'))
     24  sandbox call assert_equal("Xxx$", glob('Xxx\$'))
     25  call delete('Xxx{')
     26  call delete('Xxx$')
     27 endfunction
     28 
     29 function Test_globpath()
     30  sandbox call assert_equal(expand("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim"),
     31        \ globpath('sautest/autoload', 'glob*.vim'))
     32  sandbox call assert_equal([expand('sautest/autoload/globone.vim'), expand('sautest/autoload/globtwo.vim')],
     33        \ 'glob*.vim'->globpath('sautest/autoload', 0, 1))
     34 endfunction