Skip to content

Commit d8b2546

Browse files
committed
update test
1 parent c504fd7 commit d8b2546

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lua/neo-tree/utils/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,8 @@ end
960960
---@return string? err Error string
961961
M.fs_parent = function(path, loose)
962962
path = M.path_join(vim.fn.getcwd(), path)
963-
if #M.abspath_prefix(path) == #path then
963+
local prefix = M.abspath_prefix(path)
964+
if prefix and #prefix >= #path then
964965
return nil
965966
end
966967

tests/neo-tree/utils/fs_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ local uv = vim.uv or vim.loop
55
describe("fs_parent", function()
66
it("works", function()
77
assert.are.same(nil, utils.fs_parent("/"))
8-
assert.are.same(uv.fs_realpath("/"), utils.fs_parent("/foo"))
9-
assert.are.same(uv.fs_realpath("/"), utils.fs_parent("/foo/bar", true))
8+
assert.are.same(utils.path_separator, utils.fs_parent("/foo"))
9+
assert.are.same(utils.path_separator, utils.fs_parent("/foo/bar", true))
1010
assert.are.same(nil, utils.fs_parent("/foo/bar", false))
1111
end)
1212
end)

0 commit comments

Comments
 (0)