autochdir_spec.lua 677 B

123456789101112131415161718192021222324252627
  1. local lfs = require('lfs')
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local clear, eq = helpers.clear, helpers.eq
  4. local eval, command = helpers.eval, helpers.command
  5. describe('autochdir behavior', function()
  6. local dir = 'Xtest-functional-legacy-autochdir'
  7. before_each(function()
  8. lfs.mkdir(dir)
  9. clear()
  10. end)
  11. after_each(function()
  12. helpers.rmdir(dir)
  13. end)
  14. -- Tests vim/vim/777 without test_autochdir().
  15. it('sets filename', function()
  16. command('set acd')
  17. command('new')
  18. command('w '..dir..'/Xtest')
  19. eq('Xtest', eval("expand('%')"))
  20. eq(dir, eval([[substitute(getcwd(), '.*[/\\]\(\k*\)', '\1', '')]]))
  21. end)
  22. end)