neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

mksession_spec.lua (1149B)


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