102_fnameescape_spec.lua 639 B

12345678910111213141516171819202122232425262728
  1. -- Test if fnameescape is correct for special chars like!
  2. local n = require('test.functional.testnvim')()
  3. local clear = n.clear
  4. local command, expect = n.command, n.expect
  5. describe('fnameescape', function()
  6. setup(clear)
  7. it('is working', function()
  8. command('let fname = "Xspa ce"')
  9. command('try | exe "w! " . fnameescape(fname) | put=\'Space\' | endtry')
  10. command('let fname = "Xemark!"')
  11. command('try | exe "w! " . fnameescape(fname) | put=\'ExclamationMark\' | endtry')
  12. expect([[
  13. Space
  14. ExclamationMark]])
  15. end)
  16. teardown(function()
  17. os.remove('Xspa ce')
  18. os.remove('Xemark!')
  19. end)
  20. end)