18 lines
456 B
Lua
18 lines
456 B
Lua
local ok, fs = pcall(require, "lb:fs")
|
|
if not ok then return end
|
|
|
|
describe("temp files", function()
|
|
test("temp_dir cleans itself", function()
|
|
local path
|
|
do
|
|
local dir = fs.temp_dir()
|
|
path = dir:path()
|
|
assert(path and path ~= "")
|
|
fs.write(path .. "/test.txt", "test file")
|
|
assert(fs.read(path .. "/test.txt") == "test file")
|
|
end
|
|
collectgarbage()
|
|
assert(not pcall(fs.read, path .. "/test.txt"))
|
|
end)
|
|
end)
|