mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-24 12:35:01 +00:00
17 lines
532 B
Lua
17 lines
532 B
Lua
|
local Path = require("worldeditadditions_core.utils.path")
|
||
|
|
||
|
describe("Path.join", function()
|
||
|
it("should correct bad formatting", function()
|
||
|
local result, err = Path.join("C:\\Users\\me\\", "/Documents//code.lua")
|
||
|
assert.is_nil(err)
|
||
|
assert.are.same(
|
||
|
table.concat({"C:","Users","me","Documents","code.lua"}, Path.sep),
|
||
|
result
|
||
|
)
|
||
|
end)
|
||
|
it("should return an error if not a string", function()
|
||
|
local result, err = Path.join("C://Users/me", 123)
|
||
|
assert.is_false(result)
|
||
|
assert.are.same("string", type(err))
|
||
|
end)
|
||
|
end)
|