Skip to content

Commit a514043

Browse files
committed
Added ignore dirs test
1 parent 5039c23 commit a514043

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/dirs_spec.lua

+14
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,18 @@ describe("Directory utilities:", function()
2525
match = utils.dirs_match(cwd, allowed_dirs)
2626
assert.equals(true, match)
2727
end)
28+
29+
it("can handle only ignore directories", function()
30+
local cwd = "~/Code/Neovim/persisted.nvim"
31+
local allowed_dirs = {}
32+
local ignored_dirs = { { "/tmp" } }
33+
local allowed_match = utils.dirs_match(cwd, allowed_dirs)
34+
local ignored_match = utils.dirs_match(cwd, ignored_dirs)
35+
-- This looks weird, I know. That is because we expect dirs_match to return
36+
-- false for allowed_dirs since allowed dirs is empty.
37+
-- Therefore this is actually testing to ensure we are getting false and false
38+
-- This test specifically addresses the change added in
39+
-- https://github.com/olimorris/persisted.nvim/pull/152
40+
assert.equals(true, not allowed_match and not ignored_match)
41+
end)
2842
end)

0 commit comments

Comments
 (0)