robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

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