mksession_spec.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local clear = helpers.clear
  3. local command = helpers.command
  4. local funcs = helpers.funcs
  5. local eq = helpers.eq
  6. describe('mksession', function()
  7. before_each(clear)
  8. after_each(function()
  9. os.remove('Xtest_mks.out')
  10. end)
  11. it('supports "skiprtp" value', function()
  12. command('set sessionoptions&vi')
  13. command('set rtp+=$HOME')
  14. command('set pp+=$HOME')
  15. command('mksession! Xtest_mks.out')
  16. local found_rtp = 0
  17. local found_pp = 0
  18. for _, line in pairs(funcs.readfile('Xtest_mks.out', 'b')) do
  19. if line:find('set runtimepath') then
  20. found_rtp = found_rtp + 1
  21. end
  22. if line:find('set packpath') then
  23. found_pp = found_pp + 1
  24. end
  25. end
  26. eq(1, found_rtp)
  27. eq(1, found_pp)
  28. command('set sessionoptions+=skiprtp')
  29. command('mksession! Xtest_mks.out')
  30. local found_rtp_or_pp = 0
  31. for _, line in pairs(funcs.readfile('Xtest_mks.out', 'b')) do
  32. if line:find('set runtimepath') or line:find('set packpath') then
  33. found_rtp_or_pp = found_rtp_or_pp + 1
  34. end
  35. end
  36. eq(0, found_rtp_or_pp)
  37. end)
  38. end)