2024-10-25 16:06:15 +00:00
|
|
|
local Path = require("worldeditadditions_core.utils.path")
|
|
|
|
|
2024-10-25 23:57:49 +00:00
|
|
|
describe("Path.norm", function()
|
2024-10-25 16:06:15 +00:00
|
|
|
it("should correct bad formatting", function()
|
2024-10-25 23:57:49 +00:00
|
|
|
local result, err = Path.norm("C:\\Users\\me\\".."/Documents//code.lua")
|
2024-10-25 16:06:15 +00:00
|
|
|
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()
|
2024-10-25 23:57:49 +00:00
|
|
|
local result, err = Path.norm(123)
|
2024-10-25 16:06:15 +00:00
|
|
|
assert.is_false(result)
|
|
|
|
assert.are.same("string", type(err))
|
|
|
|
end)
|
|
|
|
end)
|