Add basic test for path.to_string()

This commit is contained in:
Folkert Kevelam 2024-10-20 21:31:53 +02:00
parent f461a3d701
commit 05b1bcb284

24
test/PathObj.lua Normal file
View File

@ -0,0 +1,24 @@
package.path = package.path .. ";../lua/SpecSwitcher/path.lua"
local PathObj = require("path")
local tests = {}
function tests.Always_Fail()
assert(false)
end
function tests.Test_Path_Functionality()
local path_1 = "/foo/bar/baz/beef.c"
local path_2 = "//foo/bar/baz/beef.c"
local path_3 = "///foo/bar/baz/beef.c"
local path_4 = "foo/bar/baz/beef.c"
assert( PathObj:new(path_1):to_string() == path_1 )
assert( PathObj:new(path_2):to_string() == path_2 )
assert( PathObj:new(path_3):to_string() == path_1 )
assert( PathObj:new(path_4):to_string() == path_4 )
end
for test_functions in pairs(tests) do
tests[test_functions]()
end