chore: add ignored_dirs test

main
olimorris 2022-04-06 23:29:06 +01:00
parent f886f9a2ec
commit 7f88f8a64c
3 changed files with 19 additions and 3 deletions

View File

@ -7,13 +7,13 @@ require("persisted").setup({
allowed_dirs = { vim.fn.getcwd() },
})
describe("With custom settings:", function()
describe("Autoloading", function()
-- after_each(function()
-- vim.fn.system("rm -rf " .. e(session_dir))
-- end)
it("autoloads a file with allowed_dirs", function()
it("autoloads a file with allowed_dirs config option present", function()
local content = vim.fn.getline(1, '$')
assert.equals(content[1], "If you're reading this, I guess auto-loading works")
end)

View File

@ -6,7 +6,7 @@ require("persisted").setup({
autosave = true,
})
describe("With custom settings:", function()
describe("Autoloading", function()
it("autoloads a file", function()
local content = vim.fn.getline(1, '$')

View File

@ -0,0 +1,16 @@
local e = vim.fn.fnameescape
local session_dir = vim.fn.getcwd() .. "/tests/dummy_data/"
require("persisted").setup({
dir = session_dir,
autoload = true,
ignored_dirs = { vim.fn.getcwd() },
})
describe("Autoloading", function()
it("is stopped if an ignored dir is present", function()
local content = vim.fn.getline(1, '$')
assert.equals(content[1], "")
end)
end)