feat: expand path_display function return type (#3074)
* feat: support path_style in path_display option * docs: document second value * tests: add test * tests: handle function in assert_path * docs: more explanation Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com> --------- Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>
This commit is contained in:
@@ -205,6 +205,9 @@ describe("transform_path", function()
|
||||
elseif type(path_display) == "table" then
|
||||
opts.path_display = path_display
|
||||
eq(expect, utils.transform_path(opts, path))
|
||||
elseif type(path_display) == "function" then
|
||||
opts.path_display = path_display
|
||||
eq(expect, utils.transform_path(opts, path))
|
||||
elseif path_display == nil then
|
||||
eq(expect, utils.transform_path(opts, path))
|
||||
end
|
||||
@@ -297,4 +300,10 @@ describe("transform_path", function()
|
||||
new_relpath "init.lua lua/telescope"
|
||||
)
|
||||
end)
|
||||
|
||||
it("handles function passed to path_display", function()
|
||||
assert_path(function(_, path)
|
||||
return string.gsub(path, "^doc", "d")
|
||||
end, new_relpath "doc/mydoc.md", new_relpath "d/mydoc.md")
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user