test_fnameescape.vim 630 B

12345678910111213141516171819202122232425262728
  1. " Test if fnameescape is correct for special chars like !
  2. func Test_fnameescape()
  3. let fname = 'Xspa ce'
  4. let status = v:false
  5. try
  6. exe "w! " . fnameescape(fname)
  7. let status = v:true
  8. endtry
  9. call assert_true(status, "Space")
  10. call delete(fname)
  11. let fname = 'Xemark!'
  12. let status = v:false
  13. try
  14. exe "w! " . fname->fnameescape()
  15. let status = v:true
  16. endtry
  17. call assert_true(status, "ExclamationMark")
  18. call delete(fname)
  19. call assert_equal('\-', fnameescape('-'))
  20. call assert_equal('\+', fnameescape('+'))
  21. call assert_equal('\>', fnameescape('>'))
  22. endfunc
  23. " vim: shiftwidth=2 sts=2 expandtab