Skip to content

Commit 8ae582d

Browse files
committed
Add specs for Path:find_upwards
1 parent a47907e commit 8ae582d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/plenary/path_spec.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,20 @@ SOFTWARE.]]
720720
assert.are.same(should, data)
721721
end)
722722
end)
723+
724+
describe(":find_upwards", function()
725+
it("finds files that exist", function()
726+
local p = Path:new(debug.getinfo(1, "S").source:sub(2))
727+
local found = p:find_upwards "README.md"
728+
assert.are.same(found:absolute(), Path:new("README.md"):absolute())
729+
end)
730+
731+
it("returns nil if no file is found", function()
732+
local p = Path:new(debug.getinfo(1, "S").source:sub(2))
733+
local found = p:find_upwards "asdf"
734+
assert.are.same(found, nil)
735+
end)
736+
end)
723737
end)
724738

725739
-- function TestPath:testIsDir()

0 commit comments

Comments
 (0)