mksession_spec.lua 1.1 KB

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